Skip to content

Commit

Permalink
publishing to GitHub packages only after packaging job completes.
Browse files Browse the repository at this point in the history
Done as a workflow_run trigger so that we can run in the right GITHUB_TOKEN context
  • Loading branch information
aaronpowell committed Sep 18, 2024
1 parent fbf9370 commit 5ecd069
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/dotnet-publish-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET Publish (GitHub Packages)
name: .NET Publish (CI)

on:
pull_request:
Expand All @@ -16,11 +16,6 @@ env:
jobs:
publish-github-packages:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET
Expand All @@ -46,6 +41,3 @@ jobs:
with:
name: nuget-packages
path: ./nuget

- name: Publish to GitHub packages
run: dotnet nuget push ./nuget/*.nupkg --source "https://nuget.pkg.github.com/tonybaloney/index.json" --api-key ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/dotnet-publish-gh-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Publish NuGet packages to GitHub Packages"
on:
workflow_run:
workflows: [".NET Publish (CI)"]
types:
- completed
jobs:
report:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: nuget-packages
run-id: ${{ github.event.workflow_run.id }}
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-publish-main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET Publish (NuGet)
name: .NET Publish (main)

on:
push:
Expand Down

0 comments on commit 5ecd069

Please sign in to comment.