Skip to content

Commit fbd8120

Browse files
committed
github/workflows/cd: Use GitHub CLI to upload assets
This replaces the softprops/action-gh-release action with directly using GitHub CLI.
1 parent cfac6f7 commit fbd8120

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

.github/workflows/cd.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,58 @@ on:
55
tags:
66
- "v[0-9]+.[0-9]+.[0-9]+"
77

8+
permissions:
9+
contents: write
10+
811
jobs:
9-
publish:
10-
name: Publish assets for ${{ matrix.job.os }}
11-
runs-on: ${{ matrix.job.os }}
12+
create:
13+
name: Create release
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@v4
17+
- env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
run: gh release create --verify-tag "$GITHUB_REF_NAME"
20+
21+
build:
22+
needs: ["create"]
23+
24+
name: Build release on ${{ matrix.os }}
25+
1226
strategy:
1327
matrix:
14-
job:
28+
include:
1529
- { os: macos-13, target: x86_64-apple-darwin }
1630
- { os: windows-2022, target: x86_64-pc-windows-msvc }
1731
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
1832

33+
runs-on: ${{ matrix.os }}
34+
1935
steps:
2036
- uses: actions/checkout@v4
2137

2238
- name: Install toolchain
2339
run: |
2440
rustup set profile minimal
25-
rustup toolchain install stable-${{ matrix.job.target }}
41+
rustup toolchain install stable-${{ matrix.target }}
2642
27-
- name: Build
43+
- name: Build release
2844
run: |
29-
cargo build --release --target ${{ matrix.job.target }}
45+
cargo build --release --target ${{ matrix.target }}
3046
31-
- name: Package
47+
- name: Package artifacts
3248
env:
33-
TARGET: ${{ matrix.job.target }}
49+
TARGET: ${{ matrix.target }}
3450
CRATE_NAME: fq
35-
OS_NAME: ${{ matrix.job.os }}
51+
OS_NAME: ${{ matrix.os }}
3652
shell: bash
37-
run: .github/scripts/before_deploy.sh
53+
run: |
54+
dst="$(.github/scripts/before_deploy.sh)"
55+
echo "ASSET_SRC=$dst" >> $GITHUB_ENV
3856
39-
- name: Release
40-
uses: softprops/action-gh-release@v2
57+
- name: Upload archive
4158
env:
4259
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
with:
44-
files: fq-*-${{ matrix.job.target }}.*
60+
shell: bash
61+
run: |
62+
gh release upload "$GITHUB_REF_NAME" ${{ env.ASSET_SRC }}

0 commit comments

Comments
 (0)