Release v2.8.0 #2
Workflow file for this run
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: Publish | |
on: | |
push: | |
tags: [ 'v*' ] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore project | |
run: | | |
dotnet restore | |
dotnet tool restore | |
- name: Build and pack project | |
run: dotnet pack -c Release | |
- name: Upload Thunderstore artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: thunderstore-build | |
path: ./dist/*.zip | |
- name: Upload nupkg artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nupkg-build | |
path: ./*/bin/Release/*.nupkg | |
upload-release-artifacts: | |
name: Upload Release Artifacts | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
RELEASE_VERSION: ${{ github.ref_name }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Delete old release if it already exists | |
run: gh release delete --yes "${RELEASE_VERSION}" | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release under current tag | |
run: | | |
export "CHANGELOG_FILE=$(mktemp --suffix=.md)" | |
echo "CHANGELOG_FILE=${CHANGELOG_FILE}" >> $GITHUB_ENV | |
gh api --method POST -H "Accept: application/vnd.github+json" \ | |
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \ | |
-f tag_name="${RELEASE_VERSION}" \ | |
--jq ".body" > "${CHANGELOG_FILE}" | |
cat "${CHANGELOG_FILE}" | |
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" thunderstore-build/*.zip nupkg-build/*/bin/Release/*.nupkg | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy-to-nuget: | |
name: Deploy to Nuget | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Download nupkg artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: nupkg-build | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Publish to NuGet.org | |
env: | |
NUGET_API_TOKEN: ${{ secrets.NUGET_API_TOKEN }} | |
run: | | |
dotnet nuget push ./*/bin/Release/*.nupkg --api-key $NUGET_API_TOKEN --source https://api.nuget.org/v3/index.json | |
deploy-to-thunderstore: | |
name: Deploy to Thunderstore | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Download Thunderstore artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: thunderstore-build | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore project tools | |
run: dotnet tool restore | |
- name: Publish to Thunderstore | |
env: | |
TCLI_AUTH_TOKEN: ${{ secrets.THUNDERSTORE_TOKEN }} | |
run: | | |
dotnet build -target:PublishThunderstoreArtifact |