Skip to content

Commit

Permalink
ci: fix release comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi committed Feb 12, 2024
1 parent c143c33 commit 93e4237
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: release

env:
RELEASE_PLEASE_AUTHOR: github-actions[bot]

on:
push:
branches: main
Expand All @@ -20,7 +23,7 @@ jobs:
with:
config-file: .github/.config/release-please-config.json
manifest-file: .release-please-manifest.json
skip-github-pull-request: ${{ startsWith(github.event.head_commit.message, 'release:') && github.event.head_commit.author.name == 'github-actions[bot]' }}
skip-github-pull-request: ${{ startsWith(github.event.head_commit.message, 'release:') && github.event.head_commit.author.name == env.RELEASE_PLEASE_AUTHOR }}

docker-publish:
needs: release-please
Expand All @@ -43,8 +46,44 @@ jobs:
steps:
- run: gh release edit ${{ needs.release-please.outputs.tag_name }} --draft=false

get-pr-number:
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
permissions: {}
runs-on: ubuntu-latest
outputs:
pr_number: ${{ steps.pr-number.outputs.pr_number }}
steps:
- name: Get PR number
id: pr-number
run: |
echo "pr_number=$(printf '${{ github.event.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]
if: ${{ needs.release-please.outputs.release_created }}
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: peter-evans/find-comment@d5fe37641ad8451bdd80312415672ba26c86575e # v3.0.0
id: fc
with:
issue-number: ${{ needs.get-pr-number.outputs.pr_number }}
comment-author: ${{ env.RELEASE_PLEASE_AUTHOR }}
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
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ needs.get-pr-number.outputs.pr_number }}
body: |
:robot: Release is at ${{ github.event.repository.html_url }}/releases/tag/${{ needs.release-please.outputs.tag_name }} :sunflower:
edit-mode: replace

label-published:
needs: [release-please, docker-publish]
needs: [release-please, publish-release, get-pr-number]
if: ${{ needs.release-please.outputs.release_created }}
permissions:
pull-requests: write
Expand All @@ -56,12 +95,8 @@ jobs:
- name: Create published label
run: |
gh label create 'autorelease: published' --color=EDEDED || true
- name: Get PR number
id: pr-number
run: |
echo "pr_number=$(printf '${{ github.event.head_commit.message }}' | head -n1 | sed -nE 's/.+\(#([0-9]+)\)$/\1/p')" >> "$GITHUB_OUTPUT"
- name: Change labels on PR
run: |
gh pr edit ${{ steps.pr-number.outputs.pr_number }} \
gh pr edit ${{ needs.get-pr-number.outputs.pr_number }} \
--remove-label='autorelease: tagged' \
--add-label='autorelease: published'

0 comments on commit 93e4237

Please sign in to comment.