Skip to content

Release 0.6.0

Release 0.6.0 #38

Workflow file for this run

name: Release
run-name: Release ${{ inputs.tag }}
on:
workflow_dispatch:
inputs:
tag:
description: "Tag / Version number"
required: true
permissions:
contents: write # required for pushing to the repository and creating releases
env:
changelog: CHANGELOG.md
readme: README.md
thunderstore-config: thunderstore.toml
project: src/*.csproj
plugin: src/Plugin.cs
jobs:
release:
name: Release ${{ inputs.tag }}
runs-on: ubuntu-latest
steps:
- name: Check input tag format
run: |
if ! echo "${{ inputs.tag }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "::error title=Invalid package version number::Version numbers must follow the Major.Minor.Patch format (e.g. 1.45.320)."
exit 1
fi
- name: Checkout files
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
with:
lfs: true
- name: Rotate unreleased section in changelog
id: rotate-changelog
uses: thomaseizinger/keep-a-changelog-new-release@f62c3c390716df5af712ba5d94f4f4a8efc1306d
with:
tag: ${{ inputs.tag }}
- name: Rotate version
run: |
NAMESPACE=$(perl -ne 'print $1 and last if /namespace = "(.*)"/' ${{ env.thunderstore-config }})
NAME=$(perl -ne 'print $1 and last if /name = "(.*)"/' ${{ env.thunderstore-config }})
sed -i "s/${NAMESPACE}-${NAME}-[0-9]\+.[0-9]\+.[0-9]\+.zip/${NAMESPACE}-${NAME}-${{ inputs.tag }}.zip/g" ${{ env.readme }}
sed -i 's/versionNumber = ".*"/versionNumber = "${{ inputs.tag }}"/' ${{ env.thunderstore-config }}
sed -i 's;<Version>.*</Version>;<Version>${{ inputs.tag }}</Version>;' ${{ env.project }}
sed -i 's/ModVersion = ".*"/ModVersion = "${{ inputs.tag }}"/' ${{ env.plugin }}
- name: Push updated files to repository
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ${{ env.changelog }} ${{ env.readme }} ${{ env.thunderstore-config }} ${{ env.project }} ${{ env.plugin }}
git commit --message "Release ${{ inputs.tag }}"
git tag ${{ inputs.tag }} --annotate --message "Release ${{ inputs.tag }}"
git push origin HEAD:${{ github.ref_name }} --tags
- name: Create release
id: release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e
with:
release_name: ${{ inputs.tag }}
tag_name: ${{ inputs.tag }}
body: ${{ steps.rotate-changelog.outputs.release-notes }}
commitish: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}