Semantic Release #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
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 |