Skip to content

Semantic Release

Semantic Release #1

name: Semantic Release
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
jobs:
semantic-release:
name: Semantic Release
runs-on: ubuntu-22.04
# Ensure CI workflow is succeeded and avoid semantic release on forked repository
if: github.event.workflow_run.conclusion == 'success' && github.repository == 'you-n-g/wan'
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@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1.10.3
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
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