-
-
Notifications
You must be signed in to change notification settings - Fork 329
51 lines (48 loc) · 1.72 KB
/
deploy.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
45
46
47
48
49
50
51
name: Build and deploy the Vapor documentation
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
jobs:
deploy:
name: Build and deploy
runs-on: ubuntu-latest
permissions: { id-token: write, contents: read }
env: { AWS_PAGER: '' }
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create virtual environment
run: python3 -m venv venv
- name: Install dependencies
run: venv/bin/pip install -r requirements.txt
- name: Build the website
run: |
venv/bin/mkdocs build
swift fixSearchIndex.swift
cp googlefc012e5d94cfa05f.html site/googlefc012e5d94cfa05f.html
swift setUpRedirects.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 CloudFormation stack
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: vapor-docs-stack
template: stack.yml
no-fail-on-empty-changeset: '1'
parameter-overrides: >-
DomainName=docs.vapor.codes,
S3BucketName=${{ secrets.DOCS_S3_BUCKET_NAME }},
AcmCertificateArn=${{ secrets.CERTIFICATE_ARN }}
- name: Upload data to S3
run: |
aws s3 sync ./site 's3://${{ secrets.DOCS_S3_BUCKET_NAME }}' --no-progress --acl public-read
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation --distribution-id '${{ secrets.DOCS_DISTRIBUTION_ID }}' --paths '/*'