Skip to content

Release

Release #198

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
required: true
description: 'Release version'
jobs:
release_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Fetch files and ensure branches exist
run: |
git fetch origin
if [ -f .git/shallow ]; then
echo "Shallow repo clone, unshallowing"
git fetch --unshallow
fi
git fetch --tags
# Check if the 'main' branch exists, if not, create it
if git rev-parse --verify main >/dev/null 2>&1; then
git checkout main
else
git checkout -b main origin/main
fi
# Check if the 'releases' branch exists, if not, create it
if git rev-parse --verify releases >/dev/null 2>&1; then
git checkout releases
else
git checkout -b releases origin/releases
fi
- name: Collect commit ranges
run: |
bash ./scripts/changelog.sh > ${{ github.workspace }}/CHANGELOG.txt
- name: Debug changelog file
run: |
ls -la ${{ github.workspace }}/CHANGELOG.txt
cat ${{ github.workspace }}/CHANGELOG.txt
echo "Current tag is: $(git rev-list --tags --max-count=1)"
- name: Checkout code from main into release branch
run: |
# Checkout the code of main onto releases
git checkout main -- .
- name: Build release
run: |
npm ci
npm run build
- name: Check in files
run: |
git add -f build/ Sources/
- name: Commit build files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Release build ${{ github.event.inputs.version }} [ci release]'
commit_options: '--allow-empty'
skip_checkout: true
branch: 'releases'
- name: Debug changelog file
run: |
ls -la ${{ github.workspace }}/CHANGELOG.txt
cat ${{ github.workspace }}/CHANGELOG.txt
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ${{ github.workspace }}/CHANGELOG.txt
draft: false
prerelease: false
tag_name: ${{ github.event.inputs.version }}
target_commitish: 'releases'