Skip to content

πŸš€(ci) Improve release workflow with tag validation and version bump a… #6

πŸš€(ci) Improve release workflow with tag validation and version bump a…

πŸš€(ci) Improve release workflow with tag validation and version bump a… #6

Workflow file for this run

name: Release
on:
push:
tags:
- "*.*.*"
jobs:
release:
name: Build And Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- name: Validate tag format
env:
TAG_VERSION: ${{ github.ref_name }}
run: |
if [[ ! "$TAG_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag $TAG_VERSION is not a valid semver (X.Y.Z)."
exit 1
fi
- name: Install dependencies
run: npm ci
- name: Bump plugin version from tag
env:
TAG_VERSION: ${{ github.ref_name }}
run: |
npm version "$TAG_VERSION" --no-git-tag-version --allow-same-version
- name: Build plugin
run: npm run build
- name: Verify release artifact
run: npm run verify:release
- name: Generate changelog
id: git-cliff
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}
- name: Publish GitHub release
uses: ncipollo/release-action@v1.21.0
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "manifest.json,dist/main.js,dist/styles.css"
body: ${{ steps.git-cliff.outputs.content }}
makeLatest: true
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
token: ${{ github.token }}