Skip to content

Commit d834e0b

Browse files
committed
update to also publish to main
1 parent 23e41c7 commit d834e0b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

docs-publish/action.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
description: The cloudfront id
99
required: true
1010
version:
11-
description: The full version of the package
11+
description: The version (only if target is main)
1212
required: true
1313
path:
1414
description: The folder to upload
@@ -20,30 +20,33 @@ runs:
2020
- shell: bash -e {0}
2121
id: vars
2222
run: |
23-
echo "Deploying from ref ${GITHUB_REF#refs/*/}"
23+
echo "Deploying from ref: ${GITHUB_REF#refs/*/}"
2424
echo "tag=${GITHUB_REF#refs/*/}" > $GITHUB_OUTPUT
25-
echo "version=${{ inputs.version }}"
2625
- name: dev
2726
shell: bash -e {0}
2827
if: |
2928
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'dev') ||
3029
(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
3132
run: |
3233
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
3435
aws cloudfront create-invalidation --distribution-id "${{ inputs.cloudfront_id }}" --paths "/en/docs/dev*"
3536
echo "::endgroup::"
3637
- name: main
3738
shell: bash -e {0}
3839
if: |
3940
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'main') ||
4041
(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
4145
run: |
4246
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 }}"
4750
echo "::endgroup::"
4851
- name: dryrun
4952
shell: bash -e {0}

0 commit comments

Comments
 (0)