Skip to content

Commit

Permalink
ci: update release-please (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi authored Nov 29, 2023
1 parent 5916031 commit a107f5d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: build
on:
push:
branches:
- 'main'
pull_request:
workflow_call:
inputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,62 +1,58 @@
on:
push:
branches:
- main

name: release-please

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
branches: main

name: on push to main

jobs:
release-please:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
pr: ${{ steps.release.outputs.pr }}
release_created: ${{ steps.release-please.outputs.release_created }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
pr: ${{ steps.release-please.outputs.pr }}
steps:
- uses: google-github-actions/release-please-action@db8f2c60ee802b3748b512940dde88eabd7b7e01 # v3.7.13
id: release
id: release-please
with:
release-type: rust
### マージしたあと、pushイベントが発火しないのでダメ
# - if: ${{ steps.release.outputs.pr }}
# name: Enable auto merge
# run: gh pr merge ${{ fromJSON(steps.release.outputs.pr).number }} --auto --delete-branch --squash
build:

docker-publish:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
permissions:
contents: write
packages: write
uses: ./.github/workflows/build.yml
uses: ./.github/workflows/docker-publish.yml
with:
tag-name: ${{ needs.release-please.outputs.tag_name }}

post-release:
needs: [build]
needs: [release-please, docker-publish]
if: ${{ needs.release-please.outputs.release_created }}
permissions:
pull-requests: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
runs-on: ubuntu-latest
steps:
- name: Create published label
run: |
gh label create 'autorelease: published test test' --color=EDEDED || :
gh label create 'autorelease: published' --color=EDEDED || :
- 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: Add comment to PR
run: |
printf ':robot: Successfully published to ${{ needs.build.outputs.image_url }} :truck:\n```\n${{ join(needs.build.outputs.image_tags, '\n') }}\n```' \
printf ':robot: Successfully published to ${{ needs.docker-publish.outputs.image_url }} :truck:\n```\n${{ join(needs.docker-publish.outputs.image_tags, '\n') }}\n```' \
| gh pr comment ${{ steps.pr-number.outputs.pr_number }} --body-file=-
- name: Change labels on PR
run: |
gh pr edit ${{ steps.pr-number.outputs.pr_number }} \
--remove-label='autorelease: tagged' \
--add-label='autorelease: published'

0 comments on commit a107f5d

Please sign in to comment.