Skip to content

Semantic Release

Semantic Release #100

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@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 'lts/*'
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }}
run: >
npx
--package [email protected]
--package [email protected]
semantic-release