-
Notifications
You must be signed in to change notification settings - Fork 4.2k
46 lines (41 loc) · 1.56 KB
/
backport-docs.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
---
name: Backport Assistant Runner For Docs (OSS only)
on:
pull_request_target:
types:
- closed
- labeled
jobs:
backport-for-docs:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
container: hashicorpdev/backport-assistant:0.2.3
steps:
- name: Backport changes to stable-website
run: |
backport-assistant backport -automerge -merge-method=squash
env:
BACKPORT_LABEL_REGEXP: "backport/(?P<target>website)"
BACKPORT_TARGET_TEMPLATE: "stable-{{.target}}"
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
- name: Backport changes labeled website to latest release branch
if: always()
run: |
resp=$(curl -f -s "https://api.github.com/repos/$GITHUB_REPOSITORY/releases?per_page=100")
ret="$?"
if [[ "$ret" -ne 0 ]]; then
echo "The GitHub API returned $ret"
exit $ret
fi
# find the latest non-rc release
latest_version=$(echo "$resp" | tr '\r\n' ' ' | jq -r '.[] | select(.name|test("^v\\d+\\.\\d+\\.\\d+$")) | .name' | sort -rV | head -n1)
echo "Latest non-rc version: $latest_version"
# strip leading "v" &
target="${latest_version#v}"
# replace patch version with "x"
target="${target%.*}.x"
export BACKPORT_TARGET_TEMPLATE="release/$target"
backport-assistant backport
env:
BACKPORT_LABEL_REGEXP: "backport/(?P<target>website)"
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}