Skip to content

Commit 812c8ff

Browse files
committed
[DEVOPS-3949] ci(nuget): use Trusted Publishing auth
1 parent a7deb2c commit 812c8ff

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/release-nugets.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
deploy:
1616
environment: publish
1717
runs-on: ubuntu-22.04
18+
permissions:
19+
id-token: write
1820

1921
steps:
2022
- uses: actions/checkout@v4
@@ -57,10 +59,16 @@ jobs:
5759
version=$(grep "version" config.txt | sed -E 's/version = "(.*)"/\1/')
5860
echo "version=$version" >> $GITHUB_OUTPUT
5961
62+
- name: NuGet login (OIDC)
63+
id: nuget-login
64+
uses: NuGet/login@v1
65+
with:
66+
user: ${{ secrets.NUGET_BOT_USERNAME }}
67+
6068
- name: Publish Core NuGet
6169
if: ${{ inputs.publish_core_nuget }}
6270
run: |
63-
COMMAND="dotnet nuget push ./devolutions-crypto-nugets/Devolutions.Crypto.Core.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
71+
COMMAND="dotnet nuget push ./devolutions-crypto-nugets/Devolutions.Crypto.Core.*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
6472
6573
if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
6674
echo "Dry Run : True"
@@ -70,7 +78,7 @@ jobs:
7078
7179
echo "Running : $COMMAND"
7280
73-
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then # if not dry run, actually run the command
81+
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then
7482
eval "$COMMAND"
7583
7684
git tag "nuget-v${{ steps.version.outputs.version }}"

0 commit comments

Comments
 (0)