Skip to content

Update workflow

Update workflow #1

Workflow file for this run

name: Publish and Release
on:
push:
branches:
- main
jobs:
publish-and-release:
name: Publish to GitHub and Thunderstore
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v4
# - name: Upload Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: build-artifacts
# path: "dist/*.zip"
- name: Setup .NET environment
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install Thunderstore CLI
run: |
dotnet tool install -g tcli
- name: Validate artifact exists
run: test -d ./dist
- name: Run script to extract changelog entry
id: extract-changelog
run: |
# Read the contents of the changelog.md file
changelog_content=$(<CHANGELOG.md)
# Extract the changelog entry corresponding to the release tag
changelog_entry=$(echo "$changelog_content" | sed -n "/## \[${{ github.ref }}\]/,/^## /p" | sed '$d')
# Store the changelog entry in an output variable
echo "::set-output name=changelog::${changelog_entry}"
continue-on-error: true
- name: Create or update release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.extract-changelog.outputs.changelog }}
draft: false
prerelease: false
- name: Publish to Thunderstore
env:
TCLI_AUTH_TOKEN: ${{ secrets.THUNDERSTORE_API_TOKEN }}
run: |
tcli publish --config-path ./assets/thunderstore.toml --file ./dist/*.zip