Skip to content

Merge pull request #223 from Chrilleweb/cmn/dev #18

Merge pull request #223 from Chrilleweb/cmn/dev

Merge pull request #223 from Chrilleweb/cmn/dev #18

Workflow file for this run

name: Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
check:
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.check.outputs.should_release }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if release is needed
id: check
run: |
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
echo "should_release=true" >> $GITHUB_OUTPUT
exit 0
fi
COMMITS=$(git log ${LAST_TAG}..HEAD --oneline)
if echo "$COMMITS" | grep -qE "^[a-f0-9]+ (feat|fix|perf|revert)(\\(.*\\))?(!)?:";
then
echo "should_release=true" >> $GITHUB_OUTPUT
else
echo "should_release=false" >> $GITHUB_OUTPUT
fi
release:
needs: check
if: needs.check.outputs.should_release == 'true'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for tags
- name: Configure git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Update npm to latest
run: npm install -g npm@latest
- run: pnpm install --frozen-lockfile
- name: Run release-it
run: pnpm release -- --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}