forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (202 loc) · 7.32 KB
/
envoy-release.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Envoy/release
permissions:
contents: read
on:
release:
types:
- published
branches:
- main
- release/v*
workflow_dispatch:
inputs:
task:
description: Select a task
required: true
default: create-release
type: choice
options:
- create-release
- sync-version-histories
pr:
type: boolean
default: true
description: Create a PR
pr-message:
description: Additional message for PR, eg to fix an issue or additional signoff (optional)
wip:
type: boolean
default: false
description: WIP
author:
description: >-
Author: User/email, eg 'Myname <[email protected]>'
(used by create-release, default: `changelogs/summary.md` last committer)
summary:
type: boolean
default: true
description: Use changelog summary (required to publish release)
env:
COMMITTER_NAME: publish-envoy[bot]
COMMITTER_EMAIL: 140627008+publish-envoy[bot]@users.noreply.github.com
jobs:
## Triggerable actions
# Create a release commit, when landed this will publish.
create_release:
runs-on: ubuntu-22.04
if: github.event_name == 'workflow_dispatch' && inputs.task == 'create-release'
name: Create release
steps:
- id: appauth
name: App auth
uses: envoyproxy/toolshed/gh-actions/[email protected]
with:
app_id: ${{ secrets.ENVOY_CI_PUBLISH_APP_ID }}
key: ${{ secrets.ENVOY_CI_PUBLISH_APP_KEY }}
- id: checkout
name: Checkout Envoy repository
uses: envoyproxy/toolshed/gh-actions/github/[email protected]
with:
committer-name: ${{ env.COMMITTER_NAME }}
committer-email: ${{ env.COMMITTER_EMAIL }}
strip-prefix: release/
token: ${{ steps.appauth.outputs.token }}
- run: |
if [[ ! -s "changelogs/summary.md" ]]; then
if [[ "${{ inputs.summary }}" == "false" ]]; then
echo "::warning::Changelog summary (changelogs/summary.md) is empty!"
exit 0
fi
echo "::error::Changelog summary (changelogs/summary.md) is empty!"
exit 1
fi
COMMITTER=$(git log -n 1 --format='%an <%ae>' -- changelogs/summary.md)
echo "committer=${COMMITTER}" >> $GITHUB_OUTPUT
id: changelog
name: Check changelog summary
- if: ${{ inputs.author }}
name: Validate signoff email
uses: envoyproxy/toolshed/gh-actions/email/[email protected]
with:
email: ${{ inputs.author }}
- uses: envoyproxy/toolshed/gh-actions/github/[email protected]
name: Create release
with:
source: |
BAZEL_ARGS=(--)
BAZEL_RUN_ARGS=(--config=ci)
if [[ -n "${{ inputs.author }}" ]]; then
BAZEL_ARGS+=(
"--release-author=${{ inputs.author }}"
"--signoff=${{ steps.changelog.outputs.committer }}")
else
BAZEL_ARGS+=("--release-author=${{ steps.changelog.outputs.committer }}")
fi
command: >-
bazel
run
"${BAZEL_RUN_ARGS[@]}"
@envoy_repo//:release
"${BAZEL_ARGS[@]}"
- run: |
VERSION=$(cat VERSION.txt)
echo "version=v${VERSION}" >> $GITHUB_OUTPUT
name: Release version
id: release
- name: Create a PR
uses: envoyproxy/toolshed/gh-actions/github/[email protected]
with:
base: ${{ github.ref_name }}
commit: false
append-commit-message: true
body: |
Created by Envoy publish bot for @${{ github.actor }}
${{ ! inputs.summary && ':warning: Created without changelog summary, this will need to be updated before publishing' || '' }}
branch: release/create/${{ steps.checkout.outputs.branch-name }}
diff-upload: release-${{ steps.checkout.outputs.branch-name }}
diff-show: true
dry-run: ${{ ! inputs.pr }}
wip: ${{ ! inputs.summary || inputs.wip }}
title: >-
[${{ (! inputs.summary || inputs.wip) && 'WIP/' || '' }}release/${{ steps.checkout.outputs.branch-name }}]
repo: Release ${{ steps.release.outputs.version }}
GITHUB_TOKEN: ${{ steps.appauth.outputs.token }}
sync_version_histories:
runs-on: ubuntu-22.04
if: github.event_name == 'workflow_dispatch' && inputs.task == 'sync-version-histories'
name: Sync version histories
steps:
- id: appauth
name: App auth
uses: envoyproxy/toolshed/gh-actions/[email protected]
with:
app_id: ${{ secrets.ENVOY_CI_PUBLISH_APP_ID }}
key: ${{ secrets.ENVOY_CI_PUBLISH_APP_KEY }}
- id: checkout
name: Checkout Envoy repository
uses: envoyproxy/toolshed/gh-actions/github/[email protected]
with:
committer-name: ${{ env.COMMITTER_NAME }}
committer-email: ${{ env.COMMITTER_EMAIL }}
strip-prefix: release/
token: ${{ steps.appauth.outputs.token }}
- uses: envoyproxy/toolshed/gh-actions/github/[email protected]
name: Sync version histories
with:
command: >-
bazel
run
--config=ci @envoy_repo//:sync
--
--signoff="${{ env.COMMITTER_NAME }} <${{ env.COMMITTER_EMAIL }}>"
- name: Create a PR
uses: envoyproxy/toolshed/gh-actions/github/[email protected]
with:
append-commit-message: true
base: ${{ github.ref_name }}
commit: false
body: |
Created by Envoy publish bot for @${{ github.actor }}
branch: release/sync/${{ steps.checkout.outputs.branch-name }}
diff-upload: version-histories-${{ steps.checkout.outputs.branch-name }}
diff-show: true
dry-run: ${{ ! inputs.pr }}
GITHUB_TOKEN: ${{ steps.appauth.outputs.token }}
title: >-
${{ steps.checkout.outputs.branch-name != 'main' && format('[{0}]', steps.checkout.outputs.branch-name) || '' }}
repo: Sync version histories
## Triggered actions
# On release to `main`:
# - fork the branch to a release branch
# - add an initial dev commit
# - remove anything unwanted
# - push branch
create_release_branch:
runs-on: ubuntu-22.04
if: github.event_name == 'release' && endsWith(github.ref, '.0')
name: Create release branch
steps:
- id: appauth
name: App auth
uses: envoyproxy/toolshed/gh-actions/[email protected]
with:
app_id: ${{ secrets.ENVOY_CI_PUBLISH_APP_ID }}
key: ${{ secrets.ENVOY_CI_PUBLISH_APP_KEY }}
- name: Checkout repository
uses: envoyproxy/toolshed/gh-actions/github/[email protected]
with:
committer-name: ${{ env.COMMITTER_NAME }}
committer-email: ${{ env.COMMITTER_EMAIL }}
token: ${{ steps.appauth.outputs.token }}
- name: Create release branch
run: |
version="$(cut -d- -f1 < VERSION.txt | cut -d. -f-2)"
release_branch="release/v${version}"
commit_sha="$(git rev-parse HEAD)"
echo "Creating ${release_branch} from ${commit_sha}"
git checkout -b "$release_branch"
bazel run @envoy_repo//:dev -- --patch
git rm -rf .github/workflows/mobile*yml
git commit . -m "repo: Remove mobile ci for release branch"
git log
git push origin "$release_branch"