-
Notifications
You must be signed in to change notification settings - Fork 2
151 lines (140 loc) · 5.53 KB
/
release-please.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: release-please
on:
push:
branches: ["main"]
permissions: {}
jobs:
release-please:
if: github.repository.fork == false
permissions: {}
runs-on: ubuntu-latest
outputs:
app-name: ${{ format('{0}[bot]', steps.generate_token.outputs.app-slug) }}
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@c8f55efbd427e7465d6da1106e7979bc8aaee856 # v1.10.1
with:
app-id: ${{ secrets.MAZI_RELEASE_APP_ID }}
private-key: ${{ secrets.MAZI_RELEASE_APP_PRIVATE_KEY }}
- uses: googleapis/release-please-action@f3969c04a4ec81d7a9aa4010d84ae6a7602f86a7 # v4.1.1
id: release
with:
token: ${{ steps.generate_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) }}
publish-crates:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
permissions: {}
uses: ./.github/workflows/publish-crates.yml
with:
dry-run: true
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@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ needs.get-pr-number.outputs.pr_number }}
comment-author: ${{ needs.release-please.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
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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
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 }}