Skip to content

TCLOUD-4780: Created workflows for automatic previews #14

TCLOUD-4780: Created workflows for automatic previews

TCLOUD-4780: Created workflows for automatic previews #14

Workflow file for this run

name: Preview Create/Update
on:
pull_request:
types:
- opened
- reopened
- synchronize
# Need ID token write permission to use OIDC
permissions:
id-token: write
env:
PR_NUMBER: ${{ github.event.number }}
RUN_NUMBER: ${{ github.run_attempt }}
jobs:
build:
name: Update Docs Preview
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout branch
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
cache: 'yarn'
node-version: 24
- name: Install dependencies
run: yarn install
- name: Build Website
run: yarn antora ./antora-playbook.yml
- name: Rename site
run: |
mv ./build/site ./build/docs
- name: Rename sitemap.xml
run: |
mv ./build/docs/sitemap.xml ./build/docs/antora-sitemap.xml
- name: configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: arn:aws:iam::327995277200:role/staging-docs-preview-update
role-session-name: docs-preview-update
aws-region: us-east-2
- name: Upload website preview to S3 # put in the docs subfolder as we rely on that path in redirects
run: |
aws s3 sync ./build s3://tiny-cloud-antora-docs-preview/pr${PR_NUMBER}/run${RUN_NUMBER}
- name: Create redirects on S3
run: |
node .github/workflows/scripts/generate_redirects.mjs tiny-cloud-antora-docs-preview pr${PR_NUMBER}/run${RUN_NUMBER}
- name: Update pointer to current run output # put in the docs subfolder as we rely on that path in redirects
run: |
aws s3api put-object --bucket tiny-cloud-antora-docs-preview --key pr${PR_NUMBER}/index.html --body .github/workflows/scripts/empty.html --content-type text/html --metadata pointer=run${RUN_NUMBER}