From f970a8f3855b69fee0d31e990848bc4e56fbd70f Mon Sep 17 00:00:00 2001 From: slievrly Date: Mon, 6 Nov 2023 10:22:18 +0800 Subject: [PATCH 1/3] optimize: deploy on oss --- .github/workflows/deploy-oss.yml | 33 ++++++++++++++++++++++++++++++++ s.yaml | 25 ++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/deploy-oss.yml create mode 100644 s.yaml diff --git a/.github/workflows/deploy-oss.yml b/.github/workflows/deploy-oss.yml new file mode 100644 index 00000000000..47891fa84b2 --- /dev/null +++ b/.github/workflows/deploy-oss.yml @@ -0,0 +1,33 @@ +name: nacos.io deploy + +on: + push: + branches: + - develop-new-framework +jobs: + Build-Deploy: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@master + - name: Use Node.js 8.x + uses: actions/setup-node@v1 + with: + node-version: 8.x + - name: Build + run: | + npm install && npm run build && mkdir -p deploy-dist && cp -R build/* deploy-dist/ && mv build deploy-dist/ + - name: Use Node.js 12.x + uses: actions/setup-node@v2 + with: + node-version: 12.x + - run: npm i @serverless-devs/s -g --registry=https://registry.npmmirror.com + - run: s config add --AccountID ${{secrets.ACCOUNT_ID}} --AccessKeyID ${{secrets.ACCESS_KEYID}} --AccessKeySecret ${{secrets.ACCESS_KEYSECRET}} -a nacos -f + - name: Deploy + run: s deploy --use-local -y + - name: Update Cache-Control + uses: doggycool/ossutil-github-action@master + with: + ossArgs: 'set-meta oss://nacos-website-cn-hongkong/ Cache-Control:no-cache -rf' + accessKey: ${{ secrets.ACCESS_KEYID }} + accessSecret: ${{ secrets.ACCESS_KEYSECRET }} + endpoint: oss-cn-hongkong.aliyuncs.com \ No newline at end of file diff --git a/s.yaml b/s.yaml new file mode 100644 index 00000000000..45123f26ea2 --- /dev/null +++ b/s.yaml @@ -0,0 +1,25 @@ +edition: 1.0.0 +name: deploy-oss +access: nacos +vars: + region: cn-hongkong + oss: + bucketName: 'nacos-website-cn-hongkong' +services: + portal-www: # 静态资源 + component: oss + actions: + post-deploy: + - plugin: cdn-cache-plugin + args: + operateType: refresh + objectPath: https://nacos.io/ + props: + region: ${vars.region} + bucket: ${vars.oss.bucketName} # OSS bucket 自动生成 + acl: public-read # 读写权限 + codeUri: ./deploy-dist # 指定本地要上传目录文件地址 + website: # OSS 静态网站配置 + index: index.html # 默认首页 + error: 404.html # 默认 404 页 + subDirType: redirect # 子目录首页 404 规则 \ No newline at end of file From b8ba168b29c35b4ae773c750126d4371c754fa9a Mon Sep 17 00:00:00 2001 From: slievrly Date: Mon, 6 Nov 2023 10:25:08 +0800 Subject: [PATCH 2/3] optimize action name --- .github/workflows/deploy-github-page.yml | 2 +- .github/workflows/deploy-oss.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-github-page.yml b/.github/workflows/deploy-github-page.yml index c40cb4c5ae8..3d60ad6f209 100644 --- a/.github/workflows/deploy-github-page.yml +++ b/.github/workflows/deploy-github-page.yml @@ -1,4 +1,4 @@ -name: nacos.io deploy +name: nacos.io deploy on github page on: push: diff --git a/.github/workflows/deploy-oss.yml b/.github/workflows/deploy-oss.yml index 47891fa84b2..ff5f70dd9a3 100644 --- a/.github/workflows/deploy-oss.yml +++ b/.github/workflows/deploy-oss.yml @@ -1,4 +1,4 @@ -name: nacos.io deploy +name: nacos.io deploy on oss on: push: From 7e4015002ff3a600af2db0afea719203ac2709fd Mon Sep 17 00:00:00 2001 From: slievrly Date: Mon, 6 Nov 2023 11:01:20 +0800 Subject: [PATCH 3/3] optimize: update node version --- .github/workflows/deploy-oss.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-oss.yml b/.github/workflows/deploy-oss.yml index ff5f70dd9a3..7563a401ff0 100644 --- a/.github/workflows/deploy-oss.yml +++ b/.github/workflows/deploy-oss.yml @@ -9,13 +9,13 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@master - - name: Use Node.js 8.x + - name: Use Node.js 18.x uses: actions/setup-node@v1 with: - node-version: 8.x + node-version: 18.x - name: Build run: | - npm install && npm run build && mkdir -p deploy-dist && cp -R build/* deploy-dist/ && mv build deploy-dist/ + npm install && npm run build && mkdir deploy-dist && cp -R build/* deploy-dist/ && mv build deploy-dist/ - name: Use Node.js 12.x uses: actions/setup-node@v2 with: