1414jobs :
1515 create-release :
1616 runs-on : ubuntu-latest
17+ outputs :
18+ upload_url : ${{ steps.create_release.outputs.upload_url }}
1719 steps :
18- - uses : actions/checkout@v4
1920 - name : Create Release
2021 id : create_release
2122 uses : actions/create-release@v1
@@ -37,18 +38,26 @@ jobs:
3738 target : x86_64-unknown-linux-gnu
3839 artifact_name : arch-cli
3940 asset_name : arch-cli-linux-amd64
41+ archive_ext : tar.gz
42+ content_type : application/gzip
4043 - os : macos-latest
4144 target : x86_64-apple-darwin
4245 artifact_name : arch-cli
4346 asset_name : arch-cli-darwin-amd64
47+ archive_ext : zip
48+ content_type : application/zip
4449 - os : macos-latest
4550 target : aarch64-apple-darwin
4651 artifact_name : arch-cli
4752 asset_name : arch-cli-darwin-arm64
53+ archive_ext : zip
54+ content_type : application/zip
4855 - os : windows-latest
4956 target : x86_64-pc-windows-msvc
5057 artifact_name : arch-cli.exe
51- asset_name : arch-cli-windows-amd64.exe
58+ asset_name : arch-cli-windows-amd64
59+ archive_ext : zip
60+ content_type : application/zip
5261
5362 steps :
5463 - uses : actions/checkout@v4
@@ -102,7 +111,11 @@ jobs:
102111 shell : bash
103112 run : |
104113 cd target/${{ matrix.target }}/release
105- tar -czf ../../../${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
114+ if [[ "${{ matrix.archive_ext }}" == "tar.gz" ]]; then
115+ tar -czf ../../../${{ matrix.asset_name }}.${{ matrix.archive_ext }} ${{ matrix.artifact_name }}
116+ else
117+ zip ../../../${{ matrix.asset_name }}.${{ matrix.archive_ext }} ${{ matrix.artifact_name }}
118+ fi
106119 cd -
107120
108121 - name : Upload Release Asset
@@ -111,6 +124,6 @@ jobs:
111124 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112125 with :
113126 upload_url : ${{ needs.create-release.outputs.upload_url }}
114- asset_path : ./${{ matrix.asset_name }}.tar.gz
115- asset_name : ${{ matrix.asset_name }}.tar.gz
116- asset_content_type : application/gzip
127+ asset_path : ./${{ matrix.asset_name }}.${{ matrix.archive_ext }}
128+ asset_name : ${{ matrix.asset_name }}.${{ matrix.archive_ext }}
129+ asset_content_type : ${{ matrix.content_type }}
0 commit comments