@@ -2,6 +2,11 @@ name: Build and Package All Runtimes
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ version :
7+ description : ' Version tag (e.g. v1.0.0)'
8+ required : true
9+ default : ' v1.0.0'
510 push :
611 tags :
712 - ' v*'
1116 runs-on : ubuntu-latest
1217 timeout-minutes : 30
1318 env :
14- GITHUB_ACTIONS : true
1519 FRAMEWORK : net8.0
1620 PROJECT : ConvertApi.Cli/ConvertApi.Cli.csproj
21+ TAG_NAME : ${{ github.ref_name }}
1722
1823 strategy :
1924 matrix :
4348 /p:DebugType=none \
4449 /p:DebugSymbols=false
4550
46- - name : Upload artifact for ${{ matrix.runtime }}
47- uses : actions/upload-artifact@v3
51+ # - name: Upload artifact for ${{ matrix.runtime }}
52+ # uses: actions/upload-artifact@v3
53+ # with:
54+ # name: convertApi-cli-${{ matrix.runtime }}
55+ # path: ConvertApi.Cli/bin/Release/${{ env.FRAMEWORK }}/${{ matrix.runtime }}/publish
56+ # retention-days: 1
57+
58+ # Use a step that archives the published files. This ensures we upload a zip asset.
59+ - name : Zip package for ${{ matrix.runtime }}
60+ run : |
61+ cd ConvertApi.Cli/bin/Release/${{ env.FRAMEWORK }}/${{ matrix.runtime }}/publish
62+ zip -r ../../../../../convertApi-cli-${{ matrix.runtime }}.zip ./*
63+
64+ # Create or update the release only once at first matrix job (not on each matrix job).
65+ - name : Create Release
66+ if : ${{ matrix.runtime == 'win-x64' }}
67+ id : create_release
68+ uses : actions/create-release@v1
69+ env :
70+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71+ with :
72+ tag_name : ${{ env.TAG_NAME }}
73+ release_name : ${{ env.TAG_NAME }}
74+ draft : false
75+ prerelease : false
76+
77+ # Upload each runtime's asset to the newly created release.
78+ - name : Upload Release Asset
79+ uses : actions/upload-release-asset@v1
80+ env :
81+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4882 with :
49- name : convertApi-cli-${{ matrix.runtime }}
50- path : ConvertApi.Cli/bin/Release/${{ env.FRAMEWORK }}/${{ matrix.runtime }}/publish
51- retention-days : 1
83+ upload_url : ${{ steps.create_release.outputs.upload_url }}
84+ asset_path : ./convertApi-cli-${{ matrix.runtime }}.zip
85+ asset_name : convertApi-cli-${{ matrix.runtime }}.zip
86+ asset_content_type : application/zip
0 commit comments