Skip to content

Commit 787451a

Browse files
author
xi xiao
committed
feat: update release binary logic
1 parent a62bd76 commit 787451a

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

.github/workflows/build-binaries.yml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
name: Build Binaries when Tagging
2-
# This is usually auto triggered by tagging from release-please Github action
3-
42
on:
53
push:
64
tags:
@@ -17,21 +15,21 @@ jobs:
1715
strategy:
1816
matrix:
1917
include:
20-
- build: linux
21-
os: ubuntu-latest
18+
- os: ubuntu-latest
2219
target: x86_64-unknown-linux-musl
20+
artifact_name: linux-x86_64
2321

24-
- build: macos
25-
os: macos-latest
22+
- os: macos-latest
2623
target: x86_64-apple-darwin
24+
artifact_name: macos-x86_64
2725

28-
- build: macos-arm
29-
os: macos-latest
26+
- os: macos-latest
3027
target: aarch64-apple-darwin
28+
artifact_name: macos-aarch64
3129

32-
- build: windows
33-
os: windows-latest
30+
- os: windows-latest
3431
target: x86_64-pc-windows-msvc
32+
artifact_name: windows-x86_64
3533

3634
steps:
3735
- name: Checkout
@@ -57,25 +55,19 @@ jobs:
5755
shell: bash
5856
run: |
5957
binary_name="afmt"
58+
artifact_base="${binary_name}-${{ env.VERSION }}-${{ matrix.artifact_name }}"
6059
61-
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
62-
mkdir "$dirname"
6360
if [ "${{ matrix.os }}" = "windows-latest" ]; then
64-
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
61+
cp "target/${{ matrix.target }}/release/${binary_name}.exe" "${binary_name}.exe"
62+
7z a "${artifact_base}.zip" "${binary_name}.exe"
63+
echo "ASSET=${artifact_base}.zip" >> $GITHUB_ENV
6564
else
66-
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
67-
fi
68-
69-
if [ "${{ matrix.os }}" = "windows-latest" ]; then
70-
7z a "$dirname.zip" "$dirname"
71-
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
72-
else
73-
tar -czf "$dirname.tar.gz" "$dirname"
74-
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
75-
fi
65+
cp "target/${{ matrix.target }}/release/${binary_name}" "${binary_name}"
66+
tar -czf "${artifact_base}.tar.gz" "${binary_name}"
67+
echo "ASSET=${artifact_base}.tar.gz" >> $GITHUB_ENV
7668
7769
- name: Release
78-
uses: softprops/action-gh-release@v1
70+
uses: softprops/action-gh-release@v
7971
with:
80-
files: |
81-
${{ env.ASSET }}
72+
files: ${{ env.ASSET }}
73+

0 commit comments

Comments
 (0)