NuGet #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: NuGet | |
on: | |
workflow_dispatch: | |
inputs: | |
version_prefix: | |
description: "Version" | |
required: true | |
type: string | |
version_suffix: | |
description: "Pre-release" | |
required: false | |
type: string | |
change_notes: | |
description: "Change Notes" | |
required: true | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: 'uncreated-networking-cleanup' | |
- name: SetupDotNet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '5.0.x' | |
- name: Build | |
run: dotnet build "./UncreatedWarfare/UncreatedWarfare.csproj" --configuration Release "/p:VersionPrefix=${{ inputs.version_prefix }};VersionSuffix=${{ inputs.version_suffix }};PackageReleaseNotes=${{ inputs.change_notes }};IsInGitHubActions=True" | |
- name: Pack | |
run: dotnet pack "./UncreatedWarfare/UncreatedWarfare.csproj" --configuration Release "/p:VersionPrefix=${{ inputs.version_prefix }};VersionSuffix=${{ inputs.version_suffix }};PackageReleaseNotes=${{ inputs.change_notes }};IsInGitHubActions=True" --no-build --output . | |
- name: Push Packages | |
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN} | |
env: | |
NUGET_TOKEN: ${{ secrets.UNCREATED_ORG_NUGET }} | |
create_tag: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
timeout-minutes: 5 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: 'uncreated-networking-cleanup' | |
fetch-depth: 0 | |
- name: SetupRepo | |
run: | | |
git remote set-url --push origin https://${{ github.actor }}:$GITHUB_TOKEN@github.com/${{ github.repository }}.git | |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com" | |
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)" | |
git config -l | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Tag | |
run: git tag -a v${{ inputs.version_prefix }}${{ inputs.version_suffix }} -m "Uncreated.Warfare v${{ inputs.version_prefix }}${{ inputs.version_suffix }} - ${{ inputs.change_notes }}" | |
- name: Push Tag | |
run: git push origin --tags |