Skip to content

Commit d0848db

Browse files
Split release to separate steps.
1 parent d36b5cf commit d0848db

File tree

1 file changed

+34
-38
lines changed

1 file changed

+34
-38
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Package All Runtimes
1+
name: Build and Release
22

33
on:
44
workflow_dispatch:
@@ -12,18 +12,40 @@ on:
1212
- 'v*'
1313

1414
jobs:
15-
build:
15+
create_release_job:
1616
runs-on: ubuntu-latest
17-
timeout-minutes: 30
18-
env:
19-
FRAMEWORK: net8.0
20-
PROJECT: ConvertApi.Cli/ConvertApi.Cli.csproj
21-
TAG_NAME: ${{ github.ref_name }}
17+
outputs:
18+
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
# - name: Setup .NET SDK
24+
# uses: actions/setup-dotnet@v4
25+
# with:
26+
# dotnet-version: '8.x'
27+
28+
# Run tests
29+
# - name: Test
30+
# run: dotnet test ConvertApi.Cli.Tests
31+
32+
- name: Create Release
33+
id: create_release
34+
uses: actions/create-release@v1
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
with:
38+
tag_name: ${{ github.ref_name }} # or an input if workflow_dispatch
39+
release_name: ${{ github.ref_name }}
40+
draft: false
41+
prerelease: false
2242

43+
build_and_upload:
44+
runs-on: ubuntu-latest
45+
needs: create_release_job
2346
strategy:
2447
matrix:
2548
runtime: [ "win-x64", "linux-x64", "linux-arm64", "osx-x64", "osx-arm64" ]
26-
2749
steps:
2850
- name: Checkout
2951
uses: actions/checkout@v4
@@ -33,13 +55,9 @@ jobs:
3355
with:
3456
dotnet-version: '8.x'
3557

36-
# Run tests
37-
# - name: Test
38-
# run: dotnet test ConvertApi.Cli.Tests
39-
4058
- name: Publish for ${{ matrix.runtime }}
4159
run: |
42-
dotnet publish ${{ env.PROJECT }} \
60+
dotnet publish ConvertApi.Cli/ConvertApi.Cli.csproj \
4361
-c Release \
4462
-r ${{ matrix.runtime }} \
4563
--self-contained true \
@@ -48,39 +66,17 @@ jobs:
4866
/p:DebugType=none \
4967
/p:DebugSymbols=false
5068
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 }}
69+
- name: Zip package
6070
run: |
61-
cd ConvertApi.Cli/bin/Release/${{ env.FRAMEWORK }}/${{ matrix.runtime }}/publish
71+
cd ConvertApi.Cli/bin/Release/net8.0/${{ matrix.runtime }}/publish
6272
zip -r ../../../../../convertApi-cli-${{ matrix.runtime }}.zip ./*
6373
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.
7874
- name: Upload Release Asset
7975
uses: actions/upload-release-asset@v1
8076
env:
8177
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8278
with:
83-
upload_url: ${{ steps.create_release.outputs.upload_url }}
79+
upload_url: ${{ needs.create_release_job.outputs.release_upload_url }}
8480
asset_path: ./convertApi-cli-${{ matrix.runtime }}.zip
8581
asset_name: convertApi-cli-${{ matrix.runtime }}.zip
8682
asset_content_type: application/zip

0 commit comments

Comments
 (0)