Official release #26
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: Official release | |
on: | |
workflow_dispatch: # Manually on demand | |
inputs: | |
versionBump: | |
description: 'Type of version bump' | |
required: true | |
default: 'prerelease' | |
type: choice | |
options: | |
- prerelease | |
- prepatch | |
- preminor | |
- premajor | |
- patch | |
- minor | |
- major | |
jobs: | |
publish-config: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
node: [20.x] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch the history, or this action won't work | |
- name: Use Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Install dependencies | |
run: npm ci && cd src-admin && npm ci | |
- name: Build | |
run: npm run build | |
- name: Test | |
run: npm test | |
- name: Prepare release | |
env: | |
VERSION_BUMP: ${{ inputs.versionBump }} | |
run: | | |
git config --global user.email "moritz.heusinger@gmail.com" | |
git config --global user.name "Github Action" | |
git diff --name-only | |
yes "" | npm run release -- ${VERSION_BUMP} alpha --yes --noPush --all --ioPackageNoPrerelease | |
- name: Determine the version bump | |
id: version | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const package = require('./package.json'); | |
return package.version | |
- name: Extract the commit body | |
id: extract_release | |
# The body may be multiline, therefore we need to escape some characters | |
run: | | |
VERSION="${{ github.ref }}" | |
VERSION=${VERSION##*/v} | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
BODY=$(git show -s --format=%b) | |
BODY="${BODY//'%'/'%25'}" | |
BODY="${BODY//$'\n'/'%0A'}" | |
BODY="${BODY//$'\r'/'%0D'}" | |
echo "BODY=$BODY" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.PR_TOKEN }} | |
commit-message: '[OFFICIAL RELEASE] ${{ steps.version.outputs.result }}' | |
committer: foxriver76 <moritz.heusinger@gmail.com> | |
author: foxriver76 <moritz.heusinger@gmail.com> | |
signoff: false | |
branch: official-release | |
delete-branch: true | |
title: '[OFFICIAL RELEASE] ${{ steps.version.outputs.result }}' | |
body: | | |
${{ steps.extract_release.outputs.BODY }} | |
labels: | | |
automated pr 🔧 | |
assignees: foxriver76 | |
draft: false |