Skip to content

Commit cba8740

Browse files
committed
chore(workflow): add rust build artifact support to release process
1 parent 3540027 commit cba8740

File tree

4 files changed

+61
-97
lines changed

4 files changed

+61
-97
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,97 +8,96 @@ on:
88
jobs:
99
build-windows:
1010
runs-on: windows-latest
11+
outputs:
12+
version: ${{ steps.get-version.outputs.version }}
1113
steps:
1214
- name: Checkout
1315
uses: actions/checkout@v4
16+
- name: Setup Rust
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
override: true
1421
- name: Setup Node.js
1522
uses: actions/setup-node@v4
1623
with:
1724
node-version: 20
18-
- name: Install dependencies
19-
run: |
20-
npm add -g pnpm postject
21-
pnpm install
25+
- name: Install cargo-make
26+
run: cargo install cargo-make
2227
- name: Build Windows
23-
run: pnpm build
28+
run: cargo make build
2429
- name: Compress Windows Artifact
25-
run: Compress-Archive -Path dist/Git_Commit_Analytics_win.exe -DestinationPath Git_Commit_Analytics_win.zip
30+
run: |
31+
Compress-Archive -Path target/release/git-commit-analytics.exe -DestinationPath git-commit-analytics_win.zip
2632
- name: Upload Windows Artifact
2733
uses: actions/upload-artifact@v4
2834
with:
2935
name: windows-build
30-
path: Git_Commit_Analytics_win.zip
36+
path: git-commit-analytics_win.zip
3137

3238
build-mac:
3339
runs-on: macos-latest
40+
outputs:
41+
version: ${{ steps.get-version.outputs.version }}
3442
steps:
3543
- name: Checkout
3644
uses: actions/checkout@v4
45+
- name: Setup Rust
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
toolchain: stable
49+
override: true
3750
- name: Setup Node.js
3851
uses: actions/setup-node@v4
3952
with:
4053
node-version: 20
41-
- name: Install dependencies
42-
run: |
43-
npm add -g pnpm postject
44-
pnpm install
54+
- name: Install cargo-make
55+
run: cargo install cargo-make
4556
- name: Build macOS
46-
run: pnpm build
57+
run: cargo make build
4758
- name: Compress macOS Artifact
48-
run: zip --junk-paths Git_Commit_Analytics_mac.zip dist/Git_Commit_Analytics_mac
59+
run: |
60+
zip --junk-paths git-commit-analytics_mac.zip target/release/git-commit-analytics
4961
- name: Upload macOS Artifact
5062
uses: actions/upload-artifact@v4
5163
with:
5264
name: mac-build
53-
path: Git_Commit_Analytics_mac.zip
65+
path: git-commit-analytics_mac.zip
5466

55-
assets:
67+
release:
5668
runs-on: ubuntu-latest
5769
needs: [build-windows, build-mac]
5870
steps:
5971
- name: Checkout
6072
uses: actions/checkout@v4
73+
- name: Setup Node.js
74+
uses: actions/setup-node@v4
75+
with:
76+
node-version: 20
77+
- name: Install semantic-release and plugins
78+
run: |
79+
npm install -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github
6180
- name: Download Windows Artifact
6281
uses: actions/download-artifact@v4
6382
with:
6483
name: windows-build
65-
path: dist/
84+
path: artifacts/
6685
- name: Download macOS Artifact
6786
uses: actions/download-artifact@v4
6887
with:
6988
name: mac-build
70-
path: dist/
89+
path: artifacts/
7190
- name: Prepare Assets
7291
run: |
73-
ls -lah dist/
74-
- name: Upload Final Assets
75-
uses: actions/upload-artifact@v4
76-
with:
77-
name: final-assets
78-
path: dist/
79-
80-
release:
81-
runs-on: ubuntu-latest
82-
needs: [assets]
83-
steps:
84-
- name: Checkout
85-
uses: actions/checkout@v4
86-
- name: Setup Node.js
87-
uses: actions/setup-node@v4
88-
with:
89-
node-version: 20
90-
- name: Install dependencies
92+
ls -lah artifacts/
93+
- name: Rename Artifacts with Version
9194
run: |
92-
npm add -g pnpm
93-
pnpm install
94-
- name: Download Final Assets
95-
uses: actions/download-artifact@v4
96-
with:
97-
name: final-assets
98-
path: ./
99-
- name: List Files
100-
run: ls -lah
95+
VERSION=$(npx semantic-release --dry-run | grep -oP 'next release version is \K[0-9]+\.[0-9]+\.[0-9]+')
96+
echo "Version detected: $VERSION"
97+
mv artifacts/git-commit-analytics_win.zip artifacts/git-commit-analytics_v${VERSION}_win.zip
98+
mv artifacts/git-commit-analytics_mac.zip artifacts/git-commit-analytics_v${VERSION}_mac.zip
10199
- name: Release
102100
env:
103101
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
104-
run: pnpm exec semantic-release
102+
run: |
103+
semantic-release

.github/workflows/upload-release-asset.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
node_modules
33
*.exe
44
*.rar
5+
*.zip
56
config.json
67
report.txt
78
dist

.releaserc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,26 @@
99
"@semantic-release/git",
1010
{
1111
"assets": [
12-
"Git_Commit_Analytics_win.zip",
13-
"Git_Commit_Analytics_mac.zip",
14-
"package.json",
12+
"Cargo.toml",
1513
"CHANGELOG.md"
1614
],
1715
"message": "release: v${nextRelease.version}\n\n${nextRelease.notes}"
1816
}
1917
],
20-
"@semantic-release/github"
18+
[
19+
"@semantic-release/github",
20+
{
21+
"assets": [
22+
{
23+
"path": "artifacts/git-commit-analytics_win.zip",
24+
"label": "Windows Build"
25+
},
26+
{
27+
"path": "artifacts/git-commit-analytics_mac.zip",
28+
"label": "macOS Build"
29+
}
30+
]
31+
}
32+
]
2133
]
2234
}

0 commit comments

Comments
 (0)