chore: Update build.yml (#405) #131
This file contains 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
on: | |
push: | |
branches: | |
- main | |
name: release-please | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
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 }} | |
steps: | |
- uses: google-github-actions/release-please-action@ca6063f4ed81b55db15b8c42d1b6f7925866342d # v3.7.11 | |
id: release | |
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: | |
needs: release-please | |
if: ${{ needs.release-please.outputs.release_created }} | |
permissions: | |
contents: write | |
packages: write | |
uses: ./.github/workflows/build.yml | |
with: | |
tag-name: ${{ needs.release-please.outputs.tag_name }} | |
post-release: | |
needs: [build] | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create published label | |
run: | | |
gh label create 'autorelease: published test test' --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```' \ | |
| 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' |