Update generate-package-api-docs.swift #92
This file contains 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: API Docs website deploy | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: { branches: [ main ] } | |
jobs: | |
deploy-site: | |
runs-on: ubuntu-latest | |
permissions: { id-token: write, contents: read } | |
env: { AWS_PAGER: '' } | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install latest Swift | |
uses: vapor/[email protected] | |
with: { toolchain: latest } | |
- name: Build site | |
run: swift generate-api-docs.swift | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ vars.OIDC_ROLE_ARN }} | |
aws-region: ${{ vars.OIDC_ROLE_REGION }} | |
- name: Deploy to CloudFormation | |
uses: aws-actions/aws-cloudformation-github-deploy@v1 | |
with: | |
name: vapor-api-docs | |
template: stack.yaml | |
no-fail-on-empty-changeset: '1' | |
parameter-overrides: >- | |
BucketName=vapor-api-docs-site, | |
SubDomainName=api, | |
HostedZoneName=vapor.codes, | |
AcmCertificateArn=${{ secrets.API_DOCS_CERTIFICATE_ARN }} | |
- name: Deploy to S3 | |
env: | |
S3_BUCKET_URL: ${{ secrets.VAPOR_API_DOCS_S3_BUCKET_URL }} | |
run: 'aws s3 sync ./public "${S3_BUCKET_URL}" --no-progress --acl public-read' | |
- name: Invalidate CloudFront | |
env: | |
DISTRIBUTION_ID: ${{ secrets.VAPOR_API_DOCS_DISTRIBUTION_ID }} | |
run: 'aws cloudfront create-invalidation --distribution-id "${DISTRIBUTION_ID}" --paths "/*"' |