@@ -8,29 +8,31 @@ inputs:
8
8
description : The cloudfront id
9
9
required : true
10
10
version :
11
- description : The full version of the package
11
+ description : The version (only if target is main)
12
12
required : true
13
13
path :
14
14
description : The folder to upload
15
15
default : ./builtdocs/
16
16
17
17
runs :
18
18
using : " composite"
19
+ env :
20
+ WEEK_CACHE : " 315360" # 3600 * 24 * 7
21
+ YEAR_CACHE : " 31536000" # 3600 * 24 * 365
19
22
steps :
20
23
- shell : bash -e {0}
21
24
id : vars
22
25
run : |
23
- echo "Deploying from ref ${GITHUB_REF#refs/*/}"
26
+ echo "Deploying from ref: ${GITHUB_REF#refs/*/}"
24
27
echo "tag=${GITHUB_REF#refs/*/}" > $GITHUB_OUTPUT
25
- echo "version=${{ inputs.version }}"
26
28
- name : dev
27
29
shell : bash -e {0}
28
30
if : |
29
31
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'dev') ||
30
32
(github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
31
33
run : |
32
34
echo "::group::Upload dev"
33
- aws s3 sync --delete "${{ inputs.path }}" "${{ inputs.url }}/en/docs/dev"
35
+ aws s3 sync --delete "${{ inputs.path }}" "${{ inputs.url }}/en/docs/dev" --cache-control max-age=$YEAR_CACHE,public
34
36
aws cloudfront create-invalidation --distribution-id "${{ inputs.cloudfront_id }}" --paths "/en/docs/dev*"
35
37
echo "::endgroup::"
36
38
- name : main
40
42
(github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
41
43
run : |
42
44
echo "::group::Upload main"
43
- echo "MAIN"
44
- # aws s3 sync --delete --dryrun "${{ inputs.path }}" "${{ inputs.url }}/en/docs/latest"
45
- # TODO: Version should work with workflow dispatch
46
- # aws s3 sync --delete --dryrun "${{ inputs.path }}" "${{ inputs.url }}/en/docs/${{ inputs.version }}"
45
+ aws s3 sync --delete --dryrun "${{ inputs.path }}" "${{ inputs.url }}/en/docs/latest" --cache-control max-age=$WEEK_CACHE,public
46
+ aws s3 sync --delete --dryrun "${{ inputs.path }}" "${{ inputs.url }}/en/docs/${{ inputs.version }}" --cache-control max-age=$YEAR_CACHE,public
47
+ aws cloudfront create-invalidation --distribution-id "${{ inputs.cloudfront_id }}" --paths "/en/docs/latest*" "/en/docs/${{ inputs.version }}"
47
48
echo "::endgroup::"
48
49
- name : dryrun
49
50
shell : bash -e {0}
0 commit comments