Skip to content

Commit 546517b

Browse files
winshine0326claude
andcommitted
ci: guard windows/linux uploads to tag pushes, artifacts on test runs
Mirror the macOS job's guarding on the windows and linux jobs so a workflow_dispatch (branch) run never publishes a junk release/tag named after the branch: upload to the release only on tag pushes, otherwise upload the built installer/package as workflow artifacts. Also derive their version the same safe way ("test" on non-tag runs) so a branch ref with "/" can't break the installer filename or Arch pkgver. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5a71cb5 commit 546517b

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,28 @@ jobs:
7474
- name: Build installer (Inno Setup)
7575
shell: pwsh
7676
env:
77-
ILKO_VERSION: ${{ github.ref_name }}
77+
ILKO_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || 'test' }}
7878
run: |
7979
$iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
8080
& $iscc windows/installer.iss
8181
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
8282
8383
- name: Upload to Release
84+
if: startsWith(github.ref, 'refs/tags/')
8485
uses: softprops/action-gh-release@v2
8586
with:
8687
files: windows/dist/installer/ILKO-*-windows-x64-setup.exe
8788
tag_name: ${{ github.ref_name }}
8889
fail_on_unmatched_files: true
8990

91+
- name: Upload installer artifact (non-tag / test runs)
92+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: ILKO-windows-setup
96+
path: windows/dist/installer/ILKO-*-windows-x64-setup.exe
97+
if-no-files-found: error
98+
9099
# ── Linux (Arch Linux package) ────────────────────────────────────────────
91100
build-linux:
92101
runs-on: ubuntu-latest
@@ -104,7 +113,7 @@ jobs:
104113
- name: Build package
105114
working-directory: linux
106115
run: |
107-
VERSION="${{ github.ref_name }}"
116+
VERSION="${{ github.ref_type == 'tag' && github.ref_name || 'test' }}"
108117
VERSION="${VERSION#v}" # strip leading 'v'
109118
VERSION="${VERSION%%-*}" # strip -alpha / -rc suffix
110119
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
@@ -124,8 +133,17 @@ jobs:
124133
echo "filename=$(ls ilko-*.pkg.tar.zst | head -1)" >> $GITHUB_OUTPUT
125134
126135
- name: Upload to Release
136+
if: startsWith(github.ref, 'refs/tags/')
127137
uses: softprops/action-gh-release@v2
128138
with:
129139
files: linux/${{ steps.pkgfile.outputs.filename }}
130140
tag_name: ${{ github.ref_name }}
131141
fail_on_unmatched_files: true
142+
143+
- name: Upload package artifact (non-tag / test runs)
144+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: ilko-linux-pkg
148+
path: linux/${{ steps.pkgfile.outputs.filename }}
149+
if-no-files-found: error

0 commit comments

Comments
 (0)