Skip to content

Semantic Release

Semantic Release #298

name: Semantic Release
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
jobs:
semantic-release:
name: Semantic Release
runs-on: ubuntu-24.04
# Ensure CI workflow is succeeded and avoid semantic release on forked repository
if: github.event.workflow_run.conclusion == 'success' && github.repository == 'serious-scaffold/ss-python'
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
steps:
- id: generate-token
name: Generate a token with GitHub App if App ID exists
if: vars.BOT_APP_ID
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Warn if use GITHUB_TOKEN
run: |
if [ -z "${{ steps.generate-token.outputs.token || secrets.PAT }}" ]; then
echo "# :warning: GITHUB_TOKEN is used for semantic-release" >> $GITHUB_STEP_SUMMARY
echo "The GITHUB_TOKEN is used instead of a bot token or PAT and will not emit the released publish event for the released workflow." >> $GITHUB_STEP_SUMMARY
fi
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }}
run: >
npx
--package conventional-changelog-conventionalcommits@9.1.0
--package semantic-release@24.2.3
semantic-release