|
| 1 | +name: Update V2 Layer ARN Docs |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + latest_published_version: |
| 7 | + description: "Latest PyPi published version to rebuild latest docs for, e.g. v2.0.0" |
| 8 | + type: string |
| 9 | + required: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +env: |
| 15 | + BRANCH: v2 |
| 16 | + |
| 17 | +jobs: |
| 18 | + publish_v2_layer_arn: |
| 19 | + # Force Github action to run only a single job at a time (based on the group name) |
| 20 | + # This is to prevent race-condition and inconsistencies with changelog push |
| 21 | + concurrency: |
| 22 | + group: changelog-build |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout repository # reusable workflows start clean, so we need to checkout again |
| 26 | + uses: actions/checkout@v3 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + - name: Git client setup and refresh tip |
| 30 | + run: | |
| 31 | + git config user.name "Release bot" |
| 32 | + git config user.email "[email protected]" |
| 33 | + git config pull.rebase true |
| 34 | + git config remote.origin.url >&- || git remote add origin https://github.com/"${origin}" # Git Detached mode (release notes) doesn't have origin |
| 35 | + git pull origin "${BRANCH}" |
| 36 | + - name: Download CDK layer artifact |
| 37 | + uses: actions/download-artifact@v3 |
| 38 | + with: |
| 39 | + name: cdk-layer-stack |
| 40 | + path: cdk-layer-stack |
| 41 | + - name: Replace layer versions in documentation |
| 42 | + run: ./layer/scripts/update_layer_arn.sh cdk-layer-stack |
| 43 | + - name: Update documentation in trunk |
| 44 | + run: | |
| 45 | + HAS_CHANGE=$(git status --porcelain) |
| 46 | + test -z "${HAS_CHANGE}" && echo "Nothing to update" && exit 0 |
| 47 | + git add docs/index.md |
| 48 | + git commit -m "chore: update v2 layer ARN on documentation" |
| 49 | + git pull origin "${BRANCH}" # prevents concurrent branch update failing push |
| 50 | + git push origin HEAD:refs/heads/"${BRANCH}" |
| 51 | +
|
| 52 | + release-docs: |
| 53 | + needs: publish_v2_layer_arn |
| 54 | + permissions: |
| 55 | + contents: write |
| 56 | + pages: write |
| 57 | + uses: ./.github/workflows/reusable_publish_docs.yml |
| 58 | + with: |
| 59 | + version: ${{ inputs.latest_published_version }} |
| 60 | + alias: latest |
0 commit comments