Skip to content

Migrate to Kiln

Migrate to Kiln #5

Workflow file for this run

name: PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
permissions:
contents: read
id-token: write
deployments: write
env:
AWS_PAGER: ""
ARCHIVE_BUCKET: s3://vapor-api-docs-archives
jobs:
build:
name: Build and Deploy PR
runs-on: ubuntu-latest
steps:
- name: Install latest Swift
uses: vapor/swiftly-action@bedb227456c5f495afbef80baebee17a8a02cef4 # v0.2.1
with:
toolchain: latest
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Setup CloudFormation linter
uses: ScottBrenner/cfn-lint-action@ed184e91f5085a2932501da8314e899e5e0ef5be # v2.7.1
- name: Run CloudFormation linter
run: cfn-lint -t stack.yaml
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1
with:
role-to-assume: ${{ vars.OIDC_ROLE_ARN }}
aws-region: ${{ vars.OIDC_ROLE_REGION }}
- name: Restore DocC archive cache
run: aws s3 sync "$ARCHIVE_BUCKET" ./Content/archives --no-progress
- name: Build site
run: swift run APIDocs
# Re-assume: a cold-cache build can outrun the 1h assume-role session.
- name: Refresh AWS credentials
uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1
with:
role-to-assume: ${{ vars.OIDC_ROLE_ARN }}
aws-region: ${{ vars.OIDC_ROLE_REGION }}
- name: Save DocC archive cache
run: aws s3 sync ./Content/archives "$ARCHIVE_BUCKET" --no-progress
- name: Deploy S3 Website
if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/api-docs' && github.actor != 'dependabot[bot]' }}
uses: brokenhandsio/s3-website-pr-action@6ebd9b622b4bb33358228571a50e05d375cbd4de # v3.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bucket-prefix: "vapor-api-docs-pulls"
folder-to-copy: "./site"
bucket-region: "eu-west-2"