Migrate to Kiln #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@9461e5d13f1c56290b8a006546dd5e845ef2c671 # v3.0.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| bucket-prefix: "vapor-api-docs-pulls" | |
| folder-to-copy: "./site" | |
| bucket-region: "eu-west-2" |