Skip to content

Release

Release #11

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
release-type:
description: 'Release type (major/minor/patch)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout dev Branch
uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
- name: Import GPG Key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Configure Git
run: |
git config --global user.email "${{ steps.import-gpg.outputs.email }}"
git config --global user.name "${{ steps.import-gpg.outputs.name }}"
git config --global commit.gpgsign true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: https://registry.npmjs.org/
- name: Install Dependencies
run: npm ci
- name: Determine New Version
id: new_version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION=$(npm version ${{ github.event.inputs.release-type }} --no-git-tag-version)
NEW_VERSION_CLEAN=${NEW_VERSION#v}
echo "current_version=$CURRENT_VERSION" >> $GITHUB_ENV
echo "new_version=$NEW_VERSION_CLEAN" >> $GITHUB_ENV
- name: Update Dependencies and Version
run: |
npm install
git add package.json package-lock.json
git commit -m "chore: bump version to ${{ env.new_version }}" || echo "No changes to commit"
- name: Push Changes to dev
run: |
git push origin dev
- name: Create Pull Request to main
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: bump version to ${{ env.new_version }}"
base: main
branch: dev
title: "Release v${{ env.new_version }}"
body: "Automated release PR for version ${{ env.new_version }}"
delete-branch: false
draft: true
labels: 'release, automated'
reviewers: 'EvanNotFound'
assignees: 'EvanNotFound'
- name: Create GitHub Release (Draft)
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: ncipollo/release-action@v1
with:
tag: "v${{ env.new_version }}"
name: "v${{ env.new_version }}"
body: "Release v${{ env.new_version }}"
draft: true
prerelease: false