Skip to content

Release-Manual

Release-Manual #21

name: Release-Manual
on:
workflow_dispatch:
inputs:
ref:
description: Git reference for what to push
default: master
required: true
version:
description: Version to release
required: true
prerelease:
description: Prerelease
default: false
required: false
type: boolean
jobs:
release:
runs-on: ubuntu-latest
environment: production
name: Build & release
steps:
- name: Check version format for prerelease
uses: actions-ecosystem/action-regex-match@v2
id: regex-match1
with:
text: ${{ github.event.inputs.version }}
regex: '^\d+\.\d+\.\d+-dev\.\d+$'
if: ${{ github.event.inputs.prerelease == 'true' }}
- name: Check version format for stable release
uses: actions-ecosystem/action-regex-match@v2
id: regex-match2
with:
text: ${{ github.event.inputs.version }}
regex: '^\d+\.\d+\.\d+$'
if: ${{ github.event.inputs.prerelease == 'false' }}
- name: Fail if version format is incorrect
run: |
echo -e "::error::Incorrect version format\nPrerelease version format example: 2.0.0-dev.0\nStable version format example: 2.0.0"
exit 1
if: ${{ steps.regex-match1.outputs.match == '' && steps.regex-match2.outputs.match == '' }}
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint --quiet
- name: Update version in package.json
run: pnpm version ${{ github.event.inputs.version }} --no-git-tag-version
- name: Build
run: pnpm build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Create changelog
run: |
echo -e "## What's Changed\n" >> changelog.txt
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"* %B" > changelog.txt
- name: Create build.zip
run: zip -r ../build/Shoko-WebUI-v${{ github.event.inputs.version }}.zip ./* -x "**/*.js.map"
working-directory: ./dist
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: ./build/Shoko-WebUI-v${{ github.event.inputs.version }}.zip
tag_name: v${{ github.event.inputs.version }}
prerelease: ${{ github.event.inputs.prerelease }}
fail_on_unmatched_files: true
body_path: ./changelog.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}