Create Version #4
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: Create Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: choice | |
description: major, minor, or patch version | |
options: | |
- patch | |
- minor | |
- major | |
env: | |
NODE_VERSION: 20.x | |
jobs: | |
createVersion: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
yarn && yarn build | |
- name: setup git config | |
run: | | |
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Create new version | |
run: | | |
echo "Version: ${{ github.event.inputs.version }}" | |
npm version ${{ github.event.inputs.version }} | |
export VERSION_NUMBER=$(node -e "const pkg=require('./package.json'); console.log(pkg.version)") | |
export VERSION="v${VERSION_NUMBER}" | |
git push origin | |
git tag -a "${VERSION}" -m "${VERSION}" | |
git push origin --tags |