Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Release Version

Release Version #1

Workflow file for this run

name: Release Version
on: workflow_dispatch
permissions:
contents: write
packages: read
statuses: write
jobs:
release:
name: Release Version
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Release
id: release
run: |
VERSION_NUMBER=$(grep '"version"' package.json | cut -d '"' -f 4)
MAJOR_VERSION_NUMBER=$(cut -d '.' -f 1 <<< "$VERSION_NUMBER")
VERSION="v$VERSION_NUMBER"
MAJOR_VERSION="v$MAJOR_VERSION_NUMBER"
# Prepare code to upload
npm run all
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Version $VERSION"
git push origin main
# Create or update a Git tag with the version number
git tag -f -a "$VERSION" -m "Version $VERSION"
# Check if the major tag already exists
if git rev-parse "$MAJOR_VERSION" >/dev/null 2>&1; then
# Update the existing major tag
git tag -f -a "$MAJOR_VERSION" -m "Version $MAJOR_VERSION"
else
# Create a new tag
git tag -a "$MAJOR_VERSION" -m "Version $MAJOR_VERSION"
fi
# Push the Git tags to GitHub
git push origin "$VERSION" --force
git push origin "$MAJOR_VERSION" --force