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 f159411 commit a5607b2
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
if: ${{ !github.event.release.prerelease }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: get_tags
Expand Down Expand Up @@ -56,34 +56,33 @@ jobs:
if: github.repository_owner == 'emqx'
steps:
- name: clone docs
uses: actions/checkout@v3
uses: actions/checkout@main
with:
fetch-depth: 0
path: docs-files

- name: clone frontend
uses: actions/checkout@v3
uses: actions/checkout@main
with:
repository: 'emqx/docs-emqx-com-frontend'
ref: next
token: ${{ secrets.CI_GIT_TOKEN }}
path: frontend

- name: use node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16
node-version-file: 'frontend/.nvmrc'

- name: use pnpm
uses: pnpm/action-setup@v2
with:
version: 8.5.1
version: 8

- name: use python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: 'x64'

- name: set env
run: |
Expand Down Expand Up @@ -115,7 +114,21 @@ jobs:
pnpm install
pnpm build
- 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 a5607b2

Please sign in to comment.