Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@


on:
workflow_call:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check for [skip] in PR title
id: check_skip
run: |
pr_title="${{ github.event.pull_request.title }}"

if [[ "$pr_title" == "[Skip]"* ]]; then
echo "skip=true" >> $GITHUB_ENV
else
echo "skip=false" >> $GITHUB_ENV
fi

- name: Verify PR title
if: env.skip == 'false'
id: determine_increment
run: |
pr_title="${{ github.event.pull_request.title }}"
latest_tag=${{ env.latest_tag }}

# Extract major, minor, and patch components from the latest tag
major=$(echo $latest_tag | cut -d. -f1 | sed 's/v//')
minor=$(echo $latest_tag | cut -d. -f2)
patch=$(echo $latest_tag | cut -d. -f3)

# Determine the increment type based on PR title
if [[ "$pr_title" == "[Major]"* ]]; then
major=$((major + 1))
minor=0
patch=0
elif [[ "$pr_title" == "[Minor]"* ]]; then
minor=$((minor + 1))
patch=0
elif [[ "$pr_title" == "[Patch]"* ]]; then
patch=$((patch + 1))
else
echo "PR title must start with [Major], [Minor], or [Patch]."
exit 1
fi

# Construct the new tag
new_tag="v${major}.${minor}.${patch}"
echo "new_tag=$new_tag" >> $GITHUB_ENV

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Install dependencies
run: npm i

- name: Build the project
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ permissions:

jobs:
build:
uses: ./.github/workflows/build.yml

release:
if: github.event.pull_request.merged == true
needs: build
runs-on: ubuntu-latest

steps:
Expand All @@ -18,16 +22,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
node-version: 'lts/*'

- name: Install dependencies
run: npm i

- name: Build the project
run: npm run build
name: dist
path: dist/

- name: Debug dist folder
run: ls -la dist
Expand Down Expand Up @@ -164,8 +163,8 @@ jobs:

rollback:
runs-on: ubuntu-latest
needs: build
if: failure() # Only run if the build job fails
needs: release
if: failure() # Only run if the release job fails

steps:
- name: Download tag artifact
Expand Down Expand Up @@ -205,3 +204,4 @@ jobs:
npm deprecate $tag "Deprecation reason" || echo "Package not found"
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}

Loading