chore: improve open source release workflow and best practices (#767) #328
This file contains hidden or 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: Release | |
on: | |
push: | |
branches: | |
- main | |
- rc | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
check-ci-status: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Wait for CI workflow | |
uses: lewagon/[email protected] | |
with: | |
ref: ${{ github.ref }} | |
check-name: 'CI' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 30 | |
release: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
needs: [check-ci-status] | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
id-token: write | |
attestations: write | |
steps: | |
- name: Generate token | |
id: app-token | |
uses: actions/create-github-app-token@v2 | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.app-token.outputs.token }} | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Run semantic-release | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |