Skip to content

Commit d089032

Browse files
committed
chore: update actions definition to upload artifacts from stable
1 parent 8ff41f3 commit d089032

1 file changed

Lines changed: 41 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,36 @@ name: Release
33
on:
44
push:
55
branches:
6-
- main
6+
- stable
77

88
jobs:
9+
prepare:
10+
name: Prepare release metadata
11+
runs-on: ubuntu-latest
12+
outputs:
13+
version: ${{ steps.extract_version.outputs.version }}
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v5
17+
18+
- name: Extract version
19+
id: extract_version
20+
run: |
21+
version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
22+
echo "version=$version" >> "$GITHUB_OUTPUT"
23+
24+
- name: Create GitHub release
25+
uses: softprops/action-gh-release@v1
26+
with:
27+
tag_name: v${{ steps.extract_version.outputs.version }}
28+
name: txtcv v${{ steps.extract_version.outputs.version }}
29+
target_commitish: ${{ github.sha }}
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
933
build:
10-
name: Build and Upload for ${{ matrix.os }}
34+
name: Build and upload ${{ matrix.target }} binary
35+
needs: prepare
1136
runs-on: ${{ matrix.os }}
1237
strategy:
1338
matrix:
@@ -20,11 +45,19 @@ jobs:
2045
- name: Checkout code
2146
uses: actions/checkout@v5
2247

23-
- name: Build binary
24-
run: cargo build --release --all-features
48+
- name: Build release binary
49+
run: cargo build --release
2550

26-
- name: Extract version
27-
id: extract_version
51+
- name: Create archive
2852
run: |
29-
version=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[0].version")
30-
echo "version=$version" >> "$GITHUB_OUTPUT"
53+
mkdir -p dist
54+
archive="dist/txtcv-${{ needs.prepare.outputs.version }}-${{ matrix.target }}.tar.gz"
55+
tar -czf "$archive" -C target/release txtcv
56+
57+
- name: Upload release asset
58+
uses: softprops/action-gh-release@v1
59+
with:
60+
tag_name: v${{ needs.prepare.outputs.version }}
61+
files: dist/txtcv-${{ needs.prepare.outputs.version }}-${{ matrix.target }}.tar.gz
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)