Files
discord-rich-presence-plugin/.github/workflows/create-release.yml
deluan 35fbcbb46e Add build and release steps to create-release workflow
Move the TinyGo build, packaging, and GitHub release creation from
release.yml into create-release.yml. This avoids the GITHUB_TOKEN
limitation where pushes from a workflow don't trigger other workflows.
release.yml is kept as a fallback for manually pushed tags.
2026-02-07 21:04:00 -05:00

81 lines
2.7 KiB
YAML

name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., 1.2.3, without the 'v' prefix)"
required: true
type: string
permissions:
contents: write
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Validate version format
env:
VERSION: ${{ inputs.version }}
run: |
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
echo "::error::Invalid version format '$VERSION'. Use X.X.X (e.g., 1.2.3)"
exit 1
fi
- name: Check out code
uses: actions/checkout@v5
- name: Check tag does not already exist
env:
VERSION: ${{ inputs.version }}
run: |
if git ls-remote --tags origin "refs/tags/v${VERSION}" | grep -q .; then
echo "::error::Tag v${VERSION} already exists"
exit 1
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests
run: go test -race ./...
- name: Update manifest.json version
env:
VERSION: ${{ inputs.version }}
run: |
jq --arg v "$VERSION" '.version = $v' manifest.json > manifest.tmp && mv manifest.tmp manifest.json
- name: Commit, tag, and push
env:
VERSION: ${{ inputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add manifest.json
git commit --allow-empty -m "Release v${VERSION}"
git tag "v${VERSION}"
git push origin main "v${VERSION}"
- name: Install TinyGo
run: |
wget https://github.com/tinygo-org/tinygo/releases/download/v0.40.1/tinygo_0.40.1_amd64.deb
sudo dpkg -i tinygo_0.40.1_amd64.deb
sudo apt install -y binaryen
- name: Build and package plugin
run: make package
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
draft: true
files: discord-rich-presence.ndp
generate_release_notes: true