Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Release

# Push a tag vX.Y.Z on main → build the Windows portable exe and publish the
# GitHub release with the matching CHANGELOG.md section as its notes.
# Build the Windows portable exe and publish the GitHub release with the
# matching CHANGELOG.md section as its notes. Two ways in:
# - push a tag vX.Y.Z;
# - run it from the Actions tab on main: the tag v<package.json version>
# is created on that commit when the release is published.
on:
push:
tags: ['v*']
workflow_dispatch:

permissions:
contents: write
Expand All @@ -18,13 +22,19 @@ jobs:
with:
node-version: 22
cache: npm
- name: Tag matches package.json
- name: Resolve tag
id: meta
shell: bash
run: |
expected="v$(node -p "require('./package.json').version")"
if [ "$expected" != "$GITHUB_REF_NAME" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match package.json ($expected)"; exit 1
tag="v$(node -p "require('./package.json').version")"
if [ "$GITHUB_REF_TYPE" = "tag" ] && [ "$GITHUB_REF_NAME" != "$tag" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match package.json ($tag)"; exit 1
fi
if [ "$GITHUB_REF_TYPE" != "tag" ] && git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null; then
echo "::error::$tag already exists; bump the version in package.json first"; exit 1
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "name=GetBox ${tag#v}" >> "$GITHUB_OUTPUT"
- run: npm ci
- run: npm run lint
- name: Tests
Expand All @@ -39,14 +49,13 @@ jobs:
- name: Package portable exe
run: npx electron-builder --win portable --publish never
- name: Release notes
id: notes
shell: bash
run: |
node scripts/release-notes.cjs "$GITHUB_REF_NAME" > release-notes.md
echo "name=GetBox ${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
run: node scripts/release-notes.cjs "${{ steps.meta.outputs.tag }}" > release-notes.md
- uses: softprops/action-gh-release@v2
with:
name: ${{ steps.notes.outputs.name }}
tag_name: ${{ steps.meta.outputs.tag }}
target_commitish: ${{ github.sha }}
name: ${{ steps.meta.outputs.name }}
body_path: release-notes.md
files: release/GetBox-*-portable.exe
fail_on_unmatched_files: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ npm run dist
### Выпуск релиза

1. Поднимите `version` в `package.json` и добавьте раздел `## X.Y.Z` в `CHANGELOG.md`.
2. После слияния в `main` поставьте тег: `git tag vX.Y.Z && git push origin vX.Y.Z`.
2. После слияния в `main` поставьте тег `git tag vX.Y.Z && git push origin vX.Y.Z` — или запустите workflow **Release** вручную на вкладке *Actions*: тег `v<версия из package.json>` создастся сам.
3. Workflow `release.yml` на `windows-latest` прогонит проверки, соберёт `GetBox-X.Y.Z-portable.exe` и опубликует релиз «GetBox X.Y.Z» с разделом из `CHANGELOG.md`.

## Структура репозитория
Expand Down
Loading