Skip to content

Version Module

Version Module #25

Workflow file for this run

name: Version Module
on:
workflow_dispatch:
inputs:
release_type:
description: 'Type of release. patch or minor (major if breaking)'
required: true
type: choice
default: patch
options:
- patch
- minor
- major
jobs:
version-module:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
strategy:
matrix:
node-version: [lts/*]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version}}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Setup GitHub Credentials
run: |
git config user.name $GITHUB_ACTOR
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
- name: Version ${{ github.event.inputs.release_type }}
run: npm version ${{ github.event.inputs.release_type }}
- name: Get new package version
run: echo "VERSION=`node -e \"const { version } = require('./package.json'); console.log(version);\"`" >> $GITHUB_ENV
- name: Create release branch
run: |
git checkout -b release/v$VERSION
git push --set-upstream origin release/v$VERSION
- name: Create PR
run: gh pr create -B main --title "Release v$VERSION" --body "Automated release of v$VERSION"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}