-
-
Notifications
You must be signed in to change notification settings - Fork 5
44 lines (43 loc) · 1.57 KB
/
deploy-api-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 "/*"'