ci: renovate #243
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
name: release-please | |
env: | |
RELEASE_PLEASE_AUTHOR: github-actions[bot] | |
on: | |
push: | |
branches: ["main"] | |
permissions: {} | |
jobs: | |
release-please: | |
if: github.repository.fork == false | |
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@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e # v4.0.2 | |
id: release | |
with: | |
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 == env.RELEASE_PLEASE_AUTHOR }} | |
publish-crates: | |
needs: release-please | |
if: ${{ needs.release-please.outputs.release_created }} | |
permissions: {} | |
uses: ./.github/workflows/publish-crates.yml | |
with: | |
dry-run: false | |
docker-publish: | |
needs: release-please | |
if: ${{ needs.release-please.outputs.release_created }} | |
permissions: | |
contents: write | |
packages: write | |
uses: ./.github/workflows/docker-publish.yml | |
with: | |
tag-name: ${{ needs.release-please.outputs.tag_name }} | |
publish-release: | |
needs: [release-please, docker-publish, publish-crates] | |
if: ${{ needs.release-please.outputs.release_created }} | |
permissions: | |
contents: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
runs-on: ubuntu-latest | |
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 | |
env: | |
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
run: | | |
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] | |
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 | |
add-docker-comment: | |
needs: [release-please, docker-publish, get-pr-number] | |
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: Add comment to PR | |
run: | | |
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 ${{ needs.get-pr-number.outputs.pr_number }} --body-file=- | |
label-published: | |
needs: [release-please, publish-release, get-pr-number] | |
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' --color=EDEDED || true | |
- name: Change labels on PR | |
run: | | |
gh pr edit ${{ needs.get-pr-number.outputs.pr_number }} \ | |
--remove-label='autorelease: tagged' \ | |
--add-label='autorelease: published' | |
move-tags: | |
needs: [release-please, publish-release] | |
if: ${{ needs.release-please.outputs.release_created }} | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
# You have to check out your repo first. | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
sparse-checkout: "" | |
sparse-checkout-cone-mode: false | |
fetch-tags: true | |
- uses: fischerscode/tagger@5ca3fa63ce3003fb7183cae547644b29f3b632be # v0.2.0 | |
with: | |
prefix: v | |
tag: ${{ needs.release-please.outputs.tag_name }} |