Skip to content

Release

Release #13

Workflow file for this run

# Template used https://superface.ai/blog/npm-publish-gh-actions-changelog
name: Release
on:
workflow_dispatch:
# Inputs the workflow accepts. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
inputs:
releaseType:
description: 'Choose release type'
default: 'patch'
required: true
type: choice
options:
- major
- minor
- patch
permissions:
contents: write
pull-requests: write
env:
NODE_VERSION: '20.x'
NPM_LOCK_LOCATION: 'frontend/package-lock.json'
jobs:
release:
runs-on: ubuntu-latest
outputs:
NEW_VERSION: ${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Git configuration
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "Github Actions on behalf of @${{ github.triggering_actor }}"
- name: Bump Release Version
id: releaseVersionUpdate
run: |
cd frontend
echo "NEW_VERSION=$(npm version ${{ inputs.releaseType }})" >> $GITHUB_OUTPUT
- name: Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd frontend
git tag ${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}
git add package.json package-lock.json
git commit -m "🔖 release: Bump version to ${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}"
git push origin ${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}
git checkout -b release/${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}
git push origin release/${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}
- name: Merge Release Data via Pull Request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: '🔖 Release ${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}',
owner,
repo,
head: 'release/${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}',
base: 'main',
body: [
'Adds release data',
'This PR is auto-generated by',
'[actions/github-script](https://github.com/actions/github-script).'
].join('\n')
});
await github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['🔖 release']
});
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.releaseVersionUpdate.outputs.NEW_VERSION }}
generate_release_notes: true