diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb7843c..b9509dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,16 +105,33 @@ jobs: if: always() build-publish: + permissions: + contents: write + issues: write + pull-requests: write runs-on: ubuntu-latest needs: - lint - test steps: + - name: Generate release bot app token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.HIROSYSTEMS_RELEASE_BOT_ID }} + private-key: ${{ secrets.HIROSYSTEMS_RELEASE_BOT_PEM }} + - uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} fetch-depth: 0 persist-credentials: false + - name: Get bot user ID + id: bot-user-id + run: | + echo "user-id=$(gh api "/users/${{ steps.generate_token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" + env: + GH_TOKEN: ${{ steps.generate_token.outputs.token }} - uses: actions/setup-node@v4 with: @@ -131,9 +148,11 @@ jobs: # Only run on non-PR events or only PRs that aren't from forks if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} SEMANTIC_RELEASE_PACKAGE: ${{ github.event.repository.name }} + GIT_AUTHOR_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com" + GIT_COMMITTER_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com" with: semantic_version: 19 extra_plugins: |