Skip to content

Commit 05e4b3d

Browse files
committed
CI
1 parent 5d22cdb commit 05e4b3d

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
include:
1515
- os: ubuntu-latest
1616
artifact_name: kiro2cc
17-
asset_name: kiro2cc-linux-amd64
17+
asset_prefix: kiro2cc-linux-amd64
1818
- os: windows-latest
1919
artifact_name: kiro2cc.exe
20-
asset_name: kiro2cc-windows-amd64.exe
20+
asset_prefix: kiro2cc-windows-amd64
2121
- os: macos-latest
2222
artifact_name: kiro2cc
23-
asset_name: kiro2cc-macos-amd64
23+
asset_prefix: kiro2cc-macos-amd64
2424

2525
steps:
2626
- name: Checkout code
@@ -35,12 +35,33 @@ jobs:
3535
- name: Build
3636
run: go build -v -o ${{ matrix.artifact_name }} .
3737

38+
- name: Install UPX
39+
shell: bash
40+
run: |
41+
if [ "${{ runner.os }}" == "Linux" ]; then
42+
sudo apt-get update && sudo apt-get install -y upx
43+
elif [ "${{ runner.os }}" == "macOS" ]; then
44+
brew install upx
45+
elif [ "${{ runner.os }}" == "Windows" ]; then
46+
choco install upx -y
47+
fi
48+
49+
- name: Compress binary with UPX
50+
shell: bash
51+
run: |
52+
upx --best --lzma ${{ matrix.artifact_name }}
53+
54+
- name: Extract version from tag
55+
id: get_version
56+
shell: bash
57+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
58+
3859
- name: Upload Release Asset
3960
uses: actions/upload-release-asset@v1
4061
env:
4162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4263
with:
4364
upload_url: ${{ github.event.release.upload_url }}
4465
asset_path: ./${{ matrix.artifact_name }}
45-
asset_name: ${{ matrix.asset_name }}
66+
asset_name: ${{ matrix.asset_prefix }}-${{ steps.get_version.outputs.VERSION }}${{ endsWith(matrix.artifact_name, '.exe') && '.exe' || '' }}
4667
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)