-
Notifications
You must be signed in to change notification settings - Fork 27
68 lines (60 loc) · 2.17 KB
/
publish-docs.yml
File metadata and controls
68 lines (60 loc) · 2.17 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Publish docs
on:
workflow_dispatch:
inputs:
version:
description: 'Documentation version (e.g. v0.1.0)'
required: false
type: string
workflow_call:
inputs:
version:
description: 'Documentation version (e.g. v0.1.0)'
required: false
type: string
permissions:
contents: read
actions: read
jobs:
validate:
name: Validate (build docs)
uses: ./.github/workflows/generate-docs.yml
with:
version: ${{ inputs.version || github.event.inputs.version || '' }}
upload_artifact: true
# Suffix with run_id so concurrent publish runs cannot collide on the
# artifact namespace within the same repository.
artifact_name: livekit-cpp-docs-${{ github.run_id }}
publish:
name: Publish (S3 + CloudFront)
needs: validate
runs-on: ubuntu-latest
steps:
- name: Download docs artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: ${{ needs.validate.outputs.artifact_name }}
path: html
- name: S3 Upload
run: |
DOCS_DIR="html"
if [[ ! -d "$DOCS_DIR" ]]; then
echo "Expected docs at $DOCS_DIR but directory not found."
exit 1
fi
VERSIONED_PREFIX="s3://livekit-docs/client-sdk-cpp/${{ needs.validate.outputs.project_number }}"
LATEST_PREFIX="s3://livekit-docs/client-sdk-cpp"
# Upload immutable versioned docs, then refresh rolling latest.
aws s3 cp "$DOCS_DIR"/ "$VERSIONED_PREFIX" --recursive
aws s3 cp "$DOCS_DIR"/ "$LATEST_PREFIX" --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "us-east-1"
- name: Invalidate cloudfront cache
run: |
aws cloudfront create-invalidation --distribution-id EJJ40KLJ3TRY9 --paths "/client-sdk-cpp/*"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "us-east-1"