Skip to content

Commit 20f6899

Browse files
committed
Fix GitHub Actions release workflow permissions
1 parent f0323d5 commit 20f6899

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- 'v*'
77

8+
permissions:
9+
contents: write
10+
packages: write
11+
812
jobs:
913
build:
1014
runs-on: ubuntu-latest
@@ -29,25 +33,38 @@ jobs:
2933
- name: Test
3034
run: dotnet test -c Release --no-build --verbosity normal
3135

32-
- name: Pack
36+
- name: Pack all projects
3337
run: dotnet pack -c Release /p:Version=${{ env.VERSION }} --no-build -o ./nupkg
38+
39+
# Pack the CLI tool specifically
40+
- name: Pack CLI Tool
41+
run: dotnet pack Smithy.Cli/Smithy.Cli.csproj -c Release /p:Version=${{ env.VERSION }} --no-build -o ./nupkg
3442

43+
# Push all NuGet packages
3544
- name: Push to NuGet
36-
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
45+
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
3746

3847
- name: Create Release
3948
id: create_release
40-
uses: actions/create-release@v1
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
uses: softprops/action-gh-release@v1
4350
with:
44-
tag_name: ${{ github.ref }}
45-
release_name: Release ${{ github.ref_name }}
51+
name: Release ${{ github.ref_name }}
4652
draft: false
4753
prerelease: false
54+
files: ./artifacts/*.nupkg
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4857

49-
- name: Upload Artifacts
58+
# Upload the NuGet packages as release assets
59+
- name: Upload CLI NuGet Package
5060
uses: actions/upload-release-asset@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
upload_url: ${{ steps.create_release.outputs.upload_url }}
65+
asset_path: ./nupkg/smithy-csharp.${{ env.VERSION }}.nupkg
66+
asset_name: smithy-csharp.${{ env.VERSION }}.nupkg
67+
asset_content_type: application/octet-stream
5168
env:
5269
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5370
with:

0 commit comments

Comments
 (0)