-
Notifications
You must be signed in to change notification settings - Fork 421
52 lines (48 loc) · 1.95 KB
/
reusable_update_v2_layer_arn_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
47
48
49
50
51
52
name: Update V2 Layer ARN Docs
on:
workflow_call:
inputs:
latest_published_version:
description: "Latest PyPi published version to rebuild latest docs for, e.g. v2.0.0"
type: string
required: true
permissions:
contents: write
env:
BRANCH: develop
jobs:
publish_v2_layer_arn:
# Force Github action to run only a single job at a time (based on the group name)
# This is to prevent race-condition and inconsistencies with changelog push
concurrency:
group: changelog-build
runs-on: ubuntu-latest
steps:
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- name: Git client setup and refresh tip
run: |
git config user.name "Release bot"
git config user.email "[email protected]"
git config pull.rebase true
git config remote.origin.url >&- || git remote add origin https://github.com/"${origin}" # Git Detached mode (release notes) doesn't have origin
git pull origin "${BRANCH}"
- name: Download CDK layer artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: cdk-layer-stack
path: cdk-layer-stack/
- name: Replace layer versions in documentation
run: |
ls -la cdk-layer-stack/
./layer/scripts/update_layer_arn.sh cdk-layer-stack
- name: Update documentation in trunk
run: |
HAS_CHANGE=$(git status --porcelain)
test -z "${HAS_CHANGE}" && echo "Nothing to update" && exit 0
git add docs/index.md examples
git commit -m "chore: update v2 layer ARN on documentation"
git pull origin "${BRANCH}" # prevents concurrent branch update failing push
git push origin HEAD:refs/heads/"${BRANCH}"