Skip to content

Commit

Permalink
ci: fix release-please
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi committed Mar 21, 2024
1 parent 0feb14a commit c715220
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
name: release-please

env:
RELEASE_PLEASE_AUTHOR: github-actions[bot]

on:
push:
branches: ["main"]

permissions: {}

jobs:
release-please:
create-token:
if: github.repository.fork == false
permissions:
contents: write
pull-requests: write
permissions: {}
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
pr: ${{ steps.release.outputs.pr }}
token: ${{ steps.generate_token.outputs.token }}
app-name: ${{ format('{0}[bot]', steps.generate_token.outputs.app-slug) }}
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@f2acddfb5195534d487896a656232b016a682f3c # v1.9.0
with:
app-id: ${{ secrets.MAZI_RELEASE_APP_ID }}
private-key: ${{ secrets.MAZI_RELEASE_APP_PRIVATE_KEY }}

release-please:
permissions:
contents: write
pull-requests: write
needs: [create-token]
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
pr: ${{ steps.release.outputs.pr }}
steps:
- uses: google-github-actions/release-please-action@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e # v4.0.2
id: release
with:
token: ${{ steps.generate_token.outputs.token }}
token: ${{ needs.create-token.outputs.token }}
config-file: .github/release-please/release-please-config.json
manifest-file: .github/release-please/.release-please-manifest.json
skip-github-pull-request: ${{ startsWith(github.event.head_commit.message, 'release:') && github.event.head_commit.author.name == format('{0}[bot]', steps.generate_token.outputs.app-slug) }}
skip-github-pull-request: ${{ startsWith(github.event.head_commit.message, 'release:') && github.event.head_commit.author.name == needs.create-token.outputs.app-name }}

publish-crates:
needs: release-please
Expand Down Expand Up @@ -81,7 +87,7 @@ jobs:
echo "pr_number=$(printf "$HEAD_COMMIT_MESSAGE" | head -n1 | sed -nE 's/.+\(#([0-9]+)\)$/\1/p')" >> "$GITHUB_OUTPUT"
update-release-comment:
needs: [release-please, publish-release, get-pr-number]
needs: [create-token, release-please, publish-release, get-pr-number]
if: ${{ needs.release-please.outputs.release_created }}
permissions:
pull-requests: write
Expand All @@ -91,7 +97,7 @@ jobs:
id: fc
with:
issue-number: ${{ needs.get-pr-number.outputs.pr_number }}
comment-author: ${{ env.RELEASE_PLEASE_AUTHOR }}
comment-author: ${{ needs.create-token.outputs.app-name }}
body-includes: ":robot: Release is at ${{ github.event.repository.html_url }}/releases/tag/untagged-"
- if: steps.fc.conclusion == 'success'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
Expand Down

0 comments on commit c715220

Please sign in to comment.