feat: add @semantic-release/commit-analyzer plugin and update release… #8
This file contains hidden or 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: Release | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Configure Git identity | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release | |
- name: Commit version update | |
run: | | |
git add package.json | |
git commit -m "chore: update package.json version [skip ci]" || echo "No version changes to commit" | |
git push origin main || echo "No changes to push" | |
- name: Stash prepack changes | |
run: | | |
git stash push -m "Stashing prepack changes" || echo "No prepack changes to stash" | |
- name: Sync dev branch with main | |
run: | | |
git fetch origin dev:dev || git checkout -b dev | |
git checkout dev | |
git pull origin dev || true | |
git merge main --ff-only || (git merge main && git push origin dev) | |
git push origin dev | |
- name: Clean up stash | |
if: always() | |
run: | | |
git stash drop || echo "No stash to drop" |