Skip to content

Create release

Create release #1

name: Create release
on:
workflow_dispatch:
inputs:
tag:
description: "Git tag value in sem ver"
required: true
type: string
env:
NODE_VERSION: latest
GIT_MAIN_BRANCH: main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_MAIN_BRANCH }}
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set up Git user
uses: fregante/setup-git-user@v2
- name: Get release version
id: version
run: echo "VALUE=$(npx --yes semver ${{ github.event.inputs.tag }})" >> "$GITHUB_OUTPUT"
- name: Update project version
run: |
npm version ${{ steps.version.outputs.VALUE }}
git add package.json
git commit -m "chore: release ${{ steps.version.outputs.VALUE }}"
git tag ${{ steps.version.outputs.VALUE }}
git push origin ${{ steps.version.outputs.VALUE }}