Skip to content

Commit 0768dd0

Browse files
snomiaoclaude
andcommitted
ci: fix release workflow — create-release job, Linux deps, gh upload
- Add create-release job so builds upload to existing release via `gh release upload --clobber` - Install libasound2-dev on Linux (needed by cpal/alsa-sys) - Fix ci-rust.yml Linux job with same ALSA dependency Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6b6f319 commit 0768dd0

2 files changed

Lines changed: 41 additions & 31 deletions

File tree

.github/workflows/ci-rust.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ jobs:
6060
steps:
6161
- uses: actions/checkout@v4
6262

63+
- name: Install system dependencies
64+
run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config
65+
6366
- name: Install Rust stable
6467
uses: dtolnay/rust-toolchain@stable
6568
with:

.github/workflows/release-rust.yml

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,40 @@ on:
66
tags:
77
- "v*"
88

9+
env:
10+
IS_PRERELEASE: ${{ contains(github.ref_name, '-') }}
11+
912
jobs:
13+
# Create the release first, then all builds upload to it
14+
create-release:
15+
name: Create GitHub Release
16+
runs-on: ubuntu-latest
17+
if: github.repository == 'snolab/CapsLockX'
18+
permissions:
19+
contents: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.ref }}
24+
25+
- name: Create or update release
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
FLAGS="--generate-notes"
30+
if [[ "${{ github.ref_name }}" == *"-"* ]]; then
31+
FLAGS="$FLAGS --prerelease"
32+
fi
33+
gh release create "${{ github.ref_name }}" $FLAGS || \
34+
gh release edit "${{ github.ref_name }}" $FLAGS
35+
1036
build-windows:
1137
name: Build Windows (x86_64-pc-windows-msvc)
38+
needs: create-release
1239
runs-on: windows-latest
1340
if: github.repository == 'snolab/CapsLockX'
14-
1541
permissions:
1642
contents: write
17-
1843
steps:
1944
- uses: actions/checkout@v4
2045
with:
@@ -53,30 +78,25 @@ jobs:
5378
git push origin main
5479
5580
- name: Upload Windows binaries
56-
uses: softprops/action-gh-release@v2
57-
with:
58-
tag_name: ${{ github.ref_name }}
59-
prerelease: ${{ contains(github.ref_name, '-') }}
60-
fail_on_unmatched_files: false
61-
files: |
62-
clx-rust.exe
63-
clx-screen-reader.exe
6481
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
run: gh release upload "${{ github.ref_name }}" clx-rust.exe clx-screen-reader.exe --clobber
6684

6785
build-linux:
6886
name: Build Linux (x86_64-unknown-linux-gnu)
87+
needs: create-release
6988
runs-on: ubuntu-latest
7089
if: github.repository == 'snolab/CapsLockX'
71-
7290
permissions:
7391
contents: write
74-
7592
steps:
7693
- uses: actions/checkout@v4
7794
with:
7895
ref: ${{ github.ref }}
7996

97+
- name: Install system dependencies
98+
run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config
99+
80100
- name: Install Rust stable
81101
uses: dtolnay/rust-toolchain@stable
82102

@@ -93,24 +113,17 @@ jobs:
93113
run: cp rs/target/release/capslockx capslockx-linux-x86_64
94114

95115
- name: Upload Linux binary
96-
uses: softprops/action-gh-release@v2
97-
with:
98-
tag_name: ${{ github.ref_name }}
99-
prerelease: ${{ contains(github.ref_name, '-') }}
100-
fail_on_unmatched_files: false
101-
files: |
102-
capslockx-linux-x86_64
103116
env:
104-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
run: gh release upload "${{ github.ref_name }}" capslockx-linux-x86_64 --clobber
105119

106120
build-macos:
107121
name: Build macOS (aarch64-apple-darwin)
122+
needs: create-release
108123
runs-on: macos-latest
109124
if: github.repository == 'snolab/CapsLockX'
110-
111125
permissions:
112126
contents: write
113-
114127
steps:
115128
- uses: actions/checkout@v4
116129
with:
@@ -145,12 +158,6 @@ jobs:
145158
git push origin main
146159
147160
- name: Upload macOS binary
148-
uses: softprops/action-gh-release@v2
149-
with:
150-
tag_name: ${{ github.ref_name }}
151-
prerelease: ${{ contains(github.ref_name, '-') }}
152-
fail_on_unmatched_files: false
153-
files: |
154-
capslockx-macos-arm64
155161
env:
156-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163+
run: gh release upload "${{ github.ref_name }}" capslockx-macos-arm64 --clobber

0 commit comments

Comments
 (0)