Skip to content

Commit 2a2c755

Browse files
authored
Revise build-and-deploy-docs-workflow.yml (#27)
1 parent 5ee29dc commit 2a2c755

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

.github/workflows/build-and-deploy-docs-workflow.yml

+25-26
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,43 @@ jobs:
2020

2121
build-docs:
2222
runs-on: ubuntu-latest
23-
container: swift:5.8
23+
container: swiftlang/swift:nightly-5.9-jammy@sha256:a3c3ec5e4436c14e44759e38416bb0d46813dc6dd050e787ef3a80b2c3051a36
2424
steps:
2525
- name: Check out code
2626
uses: actions/checkout@v3
2727
with:
2828
fetch-depth: 0
29-
- name: Install curl
29+
- name: Install curl and awscliv2
3030
run: |
31-
apt-get update && apt-get install -y curl wget awscli
31+
apt-get update && apt-get install -y curl
32+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
33+
unzip awscliv2.zip
34+
./aws/install
3235
- name: Download Files
3336
run: |
34-
curl -sL https://raw.githubusercontent.com/vapor/api-docs/main/generate-package-api-docs.swift > generate-package-api-docs.swift
35-
curl -sL https://raw.githubusercontent.com/vapor/api-docs/main/theme-settings.json > theme-settings.json
37+
curl -sL \
38+
https://raw.githubusercontent.com/vapor/api-docs/main/generate-package-api-docs.swift -o generate-package-api-docs.swift \
39+
https://raw.githubusercontent.com/vapor/api-docs/main/theme-settings.json -o theme-settings.json
3640
- name: Builds Docs
37-
run: swift generate-package-api-docs.swift ${{ inputs.package_name }} ${{ inputs.modules }}
41+
env:
42+
PACKAGE: ${{ inputs.package_name }}
43+
MODULES: ${{ inputs.modules }}
44+
run: swift generate-package-api-docs.swift ${PACKAGE} ${MODULES}
3845
- name: Configure AWS Credentials
39-
id: cred
40-
uses: aws-actions/configure-aws-credentials@v1
46+
uses: aws-actions/configure-aws-credentials@v2
4147
with:
4248
aws-access-key-id: ${{ secrets.API_DOCS_DEPLOYER_AWS_ACCESS_KEY_ID }}
4349
aws-secret-access-key: ${{ secrets.API_DOCS_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
4450
aws-region: 'eu-west-2'
45-
- name: Deploy to S3
46-
id: s3deploy
47-
uses: jakejarvis/s3-sync-action@master
48-
with:
49-
args: --acl public-read --follow-symlinks
50-
env:
51-
AWS_S3_BUCKET: 'vapor-api-docs-site'
52-
AWS_ACCESS_KEY_ID: ${{ secrets.API_DOCS_DEPLOYER_AWS_ACCESS_KEY_ID }}
53-
AWS_SECRET_ACCESS_KEY: ${{ secrets.API_DOCS_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
54-
AWS_REGION: 'eu-west-2'
55-
SOURCE_DIR: 'public'
56-
- name: Invalidate CloudFront
57-
uses: chetan/invalidate-cloudfront-action@v2
51+
- name: Deploy to S3 and invalidate CloudFront
5852
env:
59-
PATHS: ${{ inputs.pathsToInvalidate }}
60-
AWS_ACCESS_KEY_ID: ${{ secrets.API_DOCS_DEPLOYER_AWS_ACCESS_KEY_ID }}
61-
AWS_SECRET_ACCESS_KEY: ${{ secrets.API_DOCS_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
62-
AWS_REGION: 'eu-west-2'
63-
DISTRIBUTION: ${{ secrets.VAPOR_API_DOCS_DISTRIBUTION_ID }}
53+
DISTRIBUTION_ID: ${{ secrets.VAPOR_API_DOCS_DISTRIBUTION_ID }}
54+
INVALIDATE_PATHS: ${{ inputs.pathsToInvalidate }}
55+
run: |
56+
aws --no-cli-pager s3 sync \
57+
./public s3://vapor-api-docs-site \
58+
--no-progress \
59+
--acl public-read
60+
aws --no-cli-pager cloudfront create-invalidation \
61+
--distribution-id ${DISTRIBUTION_ID} \
62+
--paths ${INVALIDATE_PATHS}

0 commit comments

Comments
 (0)