Skip to content

ci: allow release workflow tag pushes (#15) #3

ci: allow release workflow tag pushes (#15)

ci: allow release workflow tag pushes (#15) #3

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Upgrade npm for trusted publishing
run: |
npm install -g npm@^11.5.1
npm --version
- run: pnpm install --frozen-lockfile
- run: npm run check
- run: sudo apt-get update && sudo apt-get install -y ripgrep
- run: npm run security
- name: Create release PR or publish
id: changesets
uses: changesets/action@v1
with:
title: "chore: release"
commit: "chore: release"
version: pnpm version-packages && pnpm install --lockfile-only
publish: pnpm release
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PROJECT_ALLOW_MAIN_PUSH: "1"
- name: Push semver GitHub tag
if: steps.changesets.outputs.published == 'true'
env:
PROJECT_ALLOW_MAIN_PUSH: "1"
run: |
VERSION="v$(node -p "require('./package.json').version")"
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION already exists"
exit 0
fi
git tag "$VERSION"
git push origin "$VERSION"