fix: fix publish.yml #3
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: Install Thunderstore CLI | |
run: dotnet tool install -g tcli | |
- name: Build project | |
run: dotnet build -c Release | |
- name: Package project | |
run: tcli build --config-path ./Thunderstore/thunderstore.toml | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: thunderstore-build | |
path: ./dist/*.zip | |
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 | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
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 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore project tools | |
run: dotnet tool restore | |
- name: Install Thunderstore CLI | |
run: dotnet tool install -g tcli | |
- name: Publish to Thunderstore | |
env: | |
TCLI_AUTH_TOKEN: ${{ secrets.TCLI_AUTH_TOKEN }} | |
run: tcli publish --config-path ./Thunderstore/thunderstore.toml --file thunderstore-build/*.zip |