Skip to content

Commit

Permalink
chore(ci): add aws cdn
Browse files Browse the repository at this point in the history
Signed-off-by: Swilder-M <[email protected]>
  • Loading branch information
Swilder-M committed Nov 21, 2023
1 parent 13487a9 commit f1204e2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/deploy_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: use pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 8

- name: use python
uses: actions/setup-python@v2
Expand Down Expand Up @@ -116,7 +116,21 @@ jobs:
$(if [ "${lang}" == "zh" ]; then echo "--templateOptions.langZH \"zh\""; fi)
done
- name: upload dist
- name: set aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

- name: upload dist to s3
run: |
aws s3 rm --recursive s3://docs-emqx-com/zh/${DOCS_TYPE}/${VERSION} || true
aws s3 rm --recursive s3://docs-emqx-com/en/${DOCS_TYPE}/${VERSION} || true
aws s3 cp --recursive frontend/docs/.vitepress/dist/ s3://docs-emqx-com/
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DOCS_CLOUDFRONT_ID }} --paths "/zh/${DOCS_TYPE}/${VERSION}/*" "/en/${DOCS_TYPE}/${VERSION}/*" "/api/${DOCS_TYPE}_versions.json" "/sitemap_${DOCS_TYPE}_${VERSION}.xml"
- name: upload dist to cos
run: |
pip3 install coscmd
coscmd config -a ${{ secrets.TENCENT_COS_ID }} -s ${{ secrets.TENCENT_COS_KEY }} -b docs-1302406139 -r ap-shanghai
Expand Down

0 comments on commit f1204e2

Please sign in to comment.