Skip to content

Merge pull request #212 from Chrilleweb/cmn/dev #8

Merge pull request #212 from Chrilleweb/cmn/dev

Merge pull request #212 from Chrilleweb/cmn/dev #8

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
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- 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: 20
registry-url: 'https://registry.npmjs.org'
- run: pnpm install --frozen-lockfile
- name: Run release-it
run: pnpm release -- --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}