name: Deploy to production (Nugets)
on:
workflow_dispatch:
inputs:
publish_core_nuget:
description: "Publish Devolutions.Crypto.Core.*.nupkg"
required: true
type: boolean
publish_dry_run:
description: "Dry Run Mode"
required: true
type: boolean
jobs:
deploy:
environment: publish
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v6
- name: Check out devolutions/actions
uses: actions/checkout@v6
with:
path: ./.github/workflows
ref: v1
repository: Devolutions/actions
token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}
- name: Install toolbox
uses: ./.github/workflows/toolbox-install
with:
github_token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}
- name: Setup git
run: |
git config user.name "devolutionsbot"
git config user.email "bot@devolutions.net"
git fetch --all
- name: Download Nugets Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI: true
run: |
dv github download-artifact nugets-windows . devolutions-crypto
dv github download-artifact config.txt . devolutions-crypto
- name: Extract Artifacts
run: |
7z x nugets-windows.zip -o./devolutions-crypto-nugets
7z x config.txt.zip
- name: Read Version
id: version
run: |
version=$(grep "version" config.txt | sed -E 's/version = "(.*)"/\1/')
echo "version=$version" >> $GITHUB_OUTPUT
- name: NuGet login (OIDC)
id: nuget-login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_BOT_USERNAME }}
- name: Publish Core NuGet
if: ${{ inputs.publish_core_nuget }}
run: |
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"
if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
echo "Dry Run : True"
else
echo "Dry Run : False"
fi
echo "Running : $COMMAND"
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then
eval "$COMMAND"
git tag "nuget-v${{ steps.version.outputs.version }}"
git push origin "nuget-v${{ steps.version.outputs.version }}"
fi