File tree Expand file tree Collapse file tree 2 files changed +93
-0
lines changed Expand file tree Collapse file tree 2 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 1+ name : docs
2+
3+ on :
4+ push :
5+ branches : [ 'release-docs' ]
6+
7+ pull_request :
8+ paths :
9+ - ' docs/**'
10+
11+ concurrency :
12+ group : cli-${{ github.workflow }}-${{ github.ref_type }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
13+ cancel-in-progress : true
14+
15+ defaults :
16+ run :
17+ shell : bash -euo pipefail {0}
18+
19+ env :
20+ GITHUB_REPOSITORY_URL : ${{ github.server_url }}/${{ github.repository }}
21+
22+ jobs :
23+
24+ docs :
25+ name : " docs"
26+ runs-on : " ubuntu-24.04"
27+ environment :
28+ name : ${{ github.ref }}
29+
30+ steps :
31+ - uses : " actions/checkout@v4"
32+ with :
33+ fetch-depth : 1
34+ submodules : true
35+
36+ - uses : " actions/setup-node@v4"
37+ with :
38+ node-version : " 22"
39+
40+ - name : " install dependencies"
41+ run : |
42+ bun install
43+
44+ - name : " build docs"
45+ run : |
46+ bun prod:build
47+
48+ - name : " deploy docs"
49+ if : ${{ endsWith(github.ref, '/release-docs') }}
50+ run : |
51+ ./docs/deploy
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euxo pipefail
3+ shopt -s globstar
4+ trap " exit" INT
5+
6+ : " ${AWS_S3_BUCKET:? The environment variable is required} "
7+ : " ${AWS_CLOUDFRONT_DISTRIBUTION_ID:? The environment variable is required} "
8+
9+ export AWS_MAX_ATTEMPTS=10
10+
11+ pushd " docs/build" > /dev/null
12+ {
13+ # Upload non-HTML files
14+ aws s3 sync \
15+ --delete \
16+ --only-show-errors \
17+ --cache-control " max-age=2592000, public" \
18+ --metadata-directive REPLACE \
19+ --exclude " *.html" \
20+ . " s3://${AWS_S3_BUCKET} /"
21+
22+ # Remove .html extension from HTML files and move them to a separate directory to handle them separately
23+ mkdir -p temporary_htmls
24+ find . -type f -name " *.html" -exec bash -c ' mv "$0" "temporary_htmls/${0%.html}"' {} \;
25+
26+ # Upload extensionless HTML files
27+ aws s3 sync \
28+ --delete \
29+ --only-show-errors \
30+ --content-type " text/html" \
31+ --cache-control " max-age=0, must-revalidate" \
32+ --metadata-directive REPLACE \
33+ temporary_htmls/ " s3://${AWS_S3_BUCKET} /"
34+
35+ # Update Cloudfront cache
36+ aws cloudfront create-invalidation \
37+ --no-paginate \
38+ --distribution-id " ${AWS_CLOUDFRONT_DISTRIBUTION_ID} " \
39+ --paths " /*" \
40+ > /dev/null
41+ }
42+ popd > /dev/null
You can’t perform that action at this time.
0 commit comments