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
@@ -20,30 +20,33 @@ runs:
20
20
- shell : bash -e {0}
21
21
id : vars
22
22
run : |
23
- echo "Deploying from ref ${GITHUB_REF#refs/*/}"
23
+ echo "Deploying from ref: ${GITHUB_REF#refs/*/}"
24
24
echo "tag=${GITHUB_REF#refs/*/}" > $GITHUB_OUTPUT
25
- echo "version=${{ inputs.version }}"
26
25
- name : dev
27
26
shell : bash -e {0}
28
27
if : |
29
28
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'dev') ||
30
29
(github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
30
+ env :
31
+ WEEK_CACHE : " 315360" # 3600 * 24 * 7
31
32
run : |
32
33
echo "::group::Upload dev"
33
- aws s3 sync --delete "${{ inputs.path }}" "${{ inputs.url }}/en/docs/dev"
34
+ aws s3 sync --delete "${{ inputs.path }}" "${{ inputs.url }}/en/docs/dev" --cache-control max-age=$YEAR_CACHE,public
34
35
aws cloudfront create-invalidation --distribution-id "${{ inputs.cloudfront_id }}" --paths "/en/docs/dev*"
35
36
echo "::endgroup::"
36
37
- name : main
37
38
shell : bash -e {0}
38
39
if : |
39
40
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'main') ||
40
41
(github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
42
+ env :
43
+ WEEK_CACHE : " 315360" # 3600 * 24 * 7
44
+ YEAR_CACHE : " 31536000" # 3600 * 24 * 365
41
45
run : |
42
46
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 }}"
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 }}"
47
50
echo "::endgroup::"
48
51
- name : dryrun
49
52
shell : bash -e {0}
0 commit comments