Skip to content

Commit 517cd6e

Browse files
committed
add switcher_path
1 parent 51ff56a commit 517cd6e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs-publish/action.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ inputs:
1313
build_path:
1414
description: The directory to upload
1515
default: ./builtdocs/
16+
switcher_path:
17+
description: The path to the switcher relative to the build_path
18+
default: _static/switcher.json
1619

1720
runs:
1821
using: "composite"
@@ -46,14 +49,16 @@ runs:
4649
WEEK_CACHE: "315360" # 3600 * 24 * 7
4750
YEAR_CACHE: "31536000" # 3600 * 24 * 365
4851
BUILD_PATH: "${{ inputs.build_path }}"
52+
SWITCHER_PATH: "${{ inputs.switcher_path }}"
4953
S3_URL: "${{ inputs.url }}"
5054
CLOUDFRONT_ID: "${{ inputs.cloudfront_id }}"
5155
VERSION: "${{ inputs.version }}"
5256
run: |
5357
echo "::group::Upload main"
5458
aws s3 sync --delete "$BUILD_PATH" "$S3_URL/en/docs/latest" --cache-control max-age=$WEEK_CACHE,public
55-
# aws s3 sync --delete "$BUILD_PATH" "$S3_URL/en/docs/$VERSION" --cache-control max-age=$YEAR_CACHE,public
56-
aws cloudfront create-invalidation --distribution-id "$CLOUDFRONT_ID" --paths "/en/docs/latest*" "/en/docs/$VERSION*"
59+
aws s3 sync --delete "$BUILD_PATH" "$S3_URL/en/docs/$VERSION" --cache-control max-age=$YEAR_CACHE,public
60+
aws s3 cp "$BUILD_PATH$SWITCHER_PATH" "$S3_URL" --cache-control max-age=$WEEK_CACHE,public
61+
aws cloudfront create-invalidation --distribution-id "$CLOUDFRONT_ID" --paths "/en/docs/latest*" "/en/docs/$VERSION*" "/switcher.json"
5762
echo "::endgroup::"
5863
- name: dryrun
5964
shell: bash -e {0}

0 commit comments

Comments
 (0)