@@ -29,10 +29,13 @@ runs:
29
29
(github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
30
30
env :
31
31
WEEK_CACHE : " 315360" # 3600 * 24 * 7
32
+ BUILD_DIR : " ${{ inputs.path }}"
33
+ S3_URL : " ${{ inputs.url }}"
34
+ CLOUDFRONT_ID : " ${{ inputs.cloudfront_id }}"
32
35
run : |
33
36
echo "::group::Upload dev"
34
- aws s3 sync --delete "${{ inputs.path }} " "${{ inputs.url }} /en/docs/dev" --cache-control max-age=$YEAR_CACHE,public
35
- aws cloudfront create-invalidation --distribution-id "${{ inputs.cloudfront_id }} " --paths "/en/docs/dev*"
37
+ aws s3 sync --delete "$BUILD_DIR " "$S3_URL /en/docs/dev" --cache-control max-age=$YEAR_CACHE,public
38
+ aws cloudfront create-invalidation --distribution-id "$CLOUDFRONT_ID " --paths "/en/docs/dev*"
36
39
echo "::endgroup::"
37
40
- name : main
38
41
shell : bash -e {0}
@@ -42,16 +45,23 @@ runs:
42
45
env :
43
46
WEEK_CACHE : " 315360" # 3600 * 24 * 7
44
47
YEAR_CACHE : " 31536000" # 3600 * 24 * 365
48
+ BUILD_DIR : " ${{ inputs.path }}"
49
+ S3_URL : " ${{ inputs.url }}"
50
+ CLOUDFRONT_ID : " ${{ inputs.cloudfront_id }}"
51
+ VERSION : " ${{ inputs.version }}"
45
52
run : |
46
53
echo "::group::Upload main"
47
- aws s3 sync --delete "${{ inputs.path }} " "${{ inputs.url }} /en/docs/latest" --cache-control max-age=$WEEK_CACHE,public
48
- # aws s3 sync --delete "${{ inputs.path }} " "${{ inputs.url }} /en/docs/${{ inputs.version }} " --cache-control max-age=$YEAR_CACHE,public
49
- aws cloudfront create-invalidation --distribution-id "${{ inputs.cloudfront_id }} " --paths "/en/docs/latest*" "/en/docs/${{ inputs.version }} *"
54
+ aws s3 sync --delete "$BUILD_DIR " "$S3_URL /en/docs/latest" --cache-control max-age=$WEEK_CACHE,public
55
+ # aws s3 sync --delete "$BUILD_DIR " "$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 *"
50
57
echo "::endgroup::"
51
58
- name : dryrun
52
59
shell : bash -e {0}
53
60
if : github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'dryrun'
61
+ env :
62
+ BUILD_DIR : " ${{ inputs.path }}"
63
+ S3_URL : " ${{ inputs.url }}"
54
64
run : |
55
65
echo "::group::Dryrun"
56
- aws s3 sync --delete --dryrun "${{ inputs.path }} " "${{ inputs.url }} /en/docs/latest"
66
+ aws s3 sync --delete --dryrun "$BUILD_DIR " "$S3_URL /en/docs/latest"
57
67
echo "::endgroup::"
0 commit comments