Skip to content

Commit 0008ed1

Browse files
authored
Merge pull request #12 from Alos-no/develop
Updated GH workflow
2 parents e634614 + 0ef2a62 commit 0008ed1

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/CI.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ on:
66
pull_request:
77
branches: [ "main", "develop" ]
88

9+
# Cancel in-progress runs when a new run is triggered for the same branch/PR.
10+
# This prevents resource conflicts during integration tests and saves CI minutes.
11+
# Reference: https://docs.github.com/en/actions/using-jobs/using-concurrency
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
916
# Restrict default permissions for security
1017
permissions:
1118
contents: read
1219

1320
jobs:
14-
# First, build the solution using the reusable workflow
21+
# First, build the solution using the reusable workflow.
22+
# Skip for PRs from develop→main since the code was already tested on push to develop.
23+
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
1524
build:
25+
if: ${{ !(github.event_name == 'pull_request' && github.head_ref == 'develop' && github.base_ref == 'main') }}
1626
uses: ./.github/workflows/build.yml
1727
with:
1828
configuration: Debug

.github/workflows/publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,23 @@ jobs:
110110
- name: NuGet Trusted Publishing Login
111111
# Exchange GitHub OIDC token for a short-lived NuGet API key
112112
# This eliminates the need for long-lived API key secrets
113+
# Reference: https://github.com/NuGet/login
113114
if: ${{ github.event.inputs.dry_run != 'true' }}
115+
id: nuget-login
114116
uses: nuget/login@v1
115117
with:
116-
owner: ${{ secrets.NUGET_USER }}
118+
user: ${{ secrets.NUGET_USER }}
117119

118120
- name: Push packages to NuGet.org
119121
# Push all packages to NuGet.org
120122
# --skip-duplicate ensures idempotency - already published versions are skipped
121-
# No --api-key needed - the login action configures authentication automatically
123+
# The API key is obtained from the login step's output (valid for ~1 hour)
122124
if: ${{ github.event.inputs.dry_run != 'true' }}
123125
run: |
124126
for package in ./artifacts/*.nupkg; do
125127
echo "Pushing: $package"
126128
dotnet nuget push "$package" \
129+
--api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" \
127130
--source https://api.nuget.org/v3/index.json \
128131
--skip-duplicate
129132
done

0 commit comments

Comments
 (0)