From d60fca90f6333633314836d1717df614fe6fe21d Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 11:35:54 +0800 Subject: [PATCH 01/14] :construction_worker: update doc publish ci --- .github/workflows/site_deploy.yml | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/site_deploy.yml diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml new file mode 100644 index 00000000..c435c33a --- /dev/null +++ b/.github/workflows/site_deploy.yml @@ -0,0 +1,50 @@ +name: Build Upload Site + +on: + push: + branches: [master, dev] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache Packages + id: yarn-cache + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install and build + run: | + yarn install + yarn build + + - name: Get Site ID + if: ${{ GITHUB_REF#refs/heads/ }} == "master" + run: | + echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" + echo "::set-env name=SITE_ID::${{ secrets.PROD_SITE_ID }}" + + - name: Get Site ID + if: ${{ GITHUB_REF#refs/heads/ }} == "dev" + run: | + echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" + echo "::set-env name=SITE_ID::${{ secrets.DEV_SITE_ID }}" + + - name: Publish + uses: netlify/actions/cli@master + with: + args: deploy --dir=docs/.vuepress/dist --prod --message="Production ${BRANCH_NAME}@${{ github.event.push.after }}" + env: + NETLIFY_SITE_ID: $SITE_ID + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From 2fa7b7ca00402601a59f7bc61c891133fa61a9ef Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 11:38:56 +0800 Subject: [PATCH 02/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index c435c33a..e8aea97e 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -29,16 +29,17 @@ jobs: yarn install yarn build + - name: Get Branch Name + run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" + - name: Get Site ID - if: ${{ GITHUB_REF#refs/heads/ }} == "master" + if: BRANCH_NAME == "master" run: | - echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" echo "::set-env name=SITE_ID::${{ secrets.PROD_SITE_ID }}" - name: Get Site ID - if: ${{ GITHUB_REF#refs/heads/ }} == "dev" + if: $BRANCH_NAME == "dev" run: | - echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" echo "::set-env name=SITE_ID::${{ secrets.DEV_SITE_ID }}" - name: Publish From 145caee37a31711b5411761f68124974a2ceb00b Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 11:44:49 +0800 Subject: [PATCH 03/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index e8aea97e..e40687c9 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -33,12 +33,12 @@ jobs: run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" - name: Get Site ID - if: BRANCH_NAME == "master" + if: env.BRANCH_NAME == "master" run: | echo "::set-env name=SITE_ID::${{ secrets.PROD_SITE_ID }}" - name: Get Site ID - if: $BRANCH_NAME == "dev" + if: env.BRANCH_NAME == "dev" run: | echo "::set-env name=SITE_ID::${{ secrets.DEV_SITE_ID }}" From 332a3a4f938f841fe370c73753a98b572dff0626 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 11:46:00 +0800 Subject: [PATCH 04/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index e40687c9..4ad09bcd 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -33,12 +33,12 @@ jobs: run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" - name: Get Site ID - if: env.BRANCH_NAME == "master" + if: env.BRANCH_NAME == 'master' run: | echo "::set-env name=SITE_ID::${{ secrets.PROD_SITE_ID }}" - name: Get Site ID - if: env.BRANCH_NAME == "dev" + if: env.BRANCH_NAME == 'dev' run: | echo "::set-env name=SITE_ID::${{ secrets.DEV_SITE_ID }}" From 36e6f5b5c1cbd1d474d7d2dfe87616895531a0d6 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 11:52:34 +0800 Subject: [PATCH 05/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 4ad09bcd..68aa47df 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -30,22 +30,22 @@ jobs: yarn build - name: Get Branch Name - run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" + run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - name: Get Site ID if: env.BRANCH_NAME == 'master' run: | - echo "::set-env name=SITE_ID::${{ secrets.PROD_SITE_ID }}" + echo "SITE_ID=${{ secrets.PROD_SITE_ID }}" >> $GITHUB_ENV - name: Get Site ID if: env.BRANCH_NAME == 'dev' run: | - echo "::set-env name=SITE_ID::${{ secrets.DEV_SITE_ID }}" + echo "SITE_ID=${{ secrets.DEV_SITE_ID }}" >> $GITHUB_ENV - name: Publish uses: netlify/actions/cli@master with: args: deploy --dir=docs/.vuepress/dist --prod --message="Production ${BRANCH_NAME}@${{ github.event.push.after }}" env: - NETLIFY_SITE_ID: $SITE_ID + NETLIFY_SITE_ID: ${{ env.SITE_ID }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From 4a961d8584d9b22e46ef14730d4f81b24ff27bdd Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 12:02:12 +0800 Subject: [PATCH 06/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 68aa47df..8582c908 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -45,7 +45,7 @@ jobs: - name: Publish uses: netlify/actions/cli@master with: - args: deploy --dir=docs/.vuepress/dist --prod --message="Production ${BRANCH_NAME}@${{ github.event.push.after }}" + args: deploy --dir=docs/.vuepress/dist --prod --message "Production ${{ env.BRANCH_NAME }}@${{ github.event.push.after }}" env: NETLIFY_SITE_ID: ${{ env.SITE_ID }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From f4d623be2558a0b90fedde95f186281c992bb691 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 12:09:37 +0800 Subject: [PATCH 07/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 8582c908..4785fbae 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -45,7 +45,7 @@ jobs: - name: Publish uses: netlify/actions/cli@master with: - args: deploy --dir=docs/.vuepress/dist --prod --message "Production ${{ env.BRANCH_NAME }}@${{ github.event.push.after }}" + args: deploy --dir=docs/.vuepress/dist --prod --message "Production ${{ github.sha }}" env: NETLIFY_SITE_ID: ${{ env.SITE_ID }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From 6eab05d57f94b30f7c9fd1d094a29a96cde0ba15 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 12:15:11 +0800 Subject: [PATCH 08/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 4785fbae..9bfe5c5c 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -45,7 +45,7 @@ jobs: - name: Publish uses: netlify/actions/cli@master with: - args: deploy --dir=docs/.vuepress/dist --prod --message "Production ${{ github.sha }}" + args: deploy --dir=docs/.vuepress/dist --prod --message="Production ${{ env.BRANCH_NAME }}@${{ github.sha }}" env: NETLIFY_SITE_ID: ${{ env.SITE_ID }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From ad47c24b60d161a56e5b6b25299162bc2a5bb2bf Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 12:19:32 +0800 Subject: [PATCH 09/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 9bfe5c5c..15612826 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -35,17 +35,16 @@ jobs: - name: Get Site ID if: env.BRANCH_NAME == 'master' run: | - echo "SITE_ID=${{ secrets.PROD_SITE_ID }}" >> $GITHUB_ENV + echo "NETLIFY_SITE_ID=${{ secrets.PROD_SITE_ID }}" >> $GITHUB_ENV - name: Get Site ID if: env.BRANCH_NAME == 'dev' run: | - echo "SITE_ID=${{ secrets.DEV_SITE_ID }}" >> $GITHUB_ENV + echo "NETLIFY_SITE_ID=${{ secrets.DEV_SITE_ID }}" >> $GITHUB_ENV - name: Publish uses: netlify/actions/cli@master with: - args: deploy --dir=docs/.vuepress/dist --prod --message="Production ${{ env.BRANCH_NAME }}@${{ github.sha }}" + args: deploy --dir=docs/.vuepress/dist --prod --message="Production|${{ env.BRANCH_NAME }}@${{ github.sha }}" env: - NETLIFY_SITE_ID: ${{ env.SITE_ID }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From 17c7903beefe10ea2ae20ec79d4e2a0a33695140 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 12:23:52 +0800 Subject: [PATCH 10/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 15612826..cfee27b2 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -45,6 +45,6 @@ jobs: - name: Publish uses: netlify/actions/cli@master with: - args: deploy --dir=docs/.vuepress/dist --prod --message="Production|${{ env.BRANCH_NAME }}@${{ github.sha }}" + args: deploy --dir=docs/.vuepress/dist --prod --message='Production ${{ env.BRANCH_NAME }}@${{ github.sha }}' env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From aba18a2f68c06b28ee5fa9de25d951fa840b9f1d Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 12:58:24 +0800 Subject: [PATCH 11/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 33 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index cfee27b2..592db3bc 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -2,7 +2,7 @@ name: Build Upload Site on: push: - branches: [master, dev] + pull_request: jobs: publish: @@ -32,19 +32,20 @@ jobs: - name: Get Branch Name run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - - name: Get Site ID - if: env.BRANCH_NAME == 'master' - run: | - echo "NETLIFY_SITE_ID=${{ secrets.PROD_SITE_ID }}" >> $GITHUB_ENV - - - name: Get Site ID - if: env.BRANCH_NAME == 'dev' - run: | - echo "NETLIFY_SITE_ID=${{ secrets.DEV_SITE_ID }}" >> $GITHUB_ENV - - - name: Publish - uses: netlify/actions/cli@master + - name: Production Deploy + if: github.event_name == 'push' && env.BRANCH_NAME == 'master' + uses: nwtgck/actions-netlify@v1.1 with: - args: deploy --dir=docs/.vuepress/dist --prod --message='Production ${{ env.BRANCH_NAME }}@${{ github.sha }}' - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + publish-dir: './docs/.vuepress/dist' + production-branch: ${{ env.BRANCH_NAME }} + production-deploy: true + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: 'Production Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}' + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1.1 + with: + publish-dir: './docs/.vuepress/dist' + production-branch: ${{ env.BRANCH_NAME }} + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: 'Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}' From eeec690e7146789d064e9cf7910d4a1daa94a7cb Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 13:00:25 +0800 Subject: [PATCH 12/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 592db3bc..f063a74b 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -49,3 +49,6 @@ jobs: production-branch: ${{ env.BRANCH_NAME }} github-token: ${{ secrets.GITHUB_TOKEN }} deploy-message: 'Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}' + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.SITE_ID }} From 7b2af1b2f3ccbc97ce26e43ab81d161af11df2fd Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 13:42:09 +0800 Subject: [PATCH 13/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index f063a74b..3065604e 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -32,21 +32,11 @@ jobs: - name: Get Branch Name run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - - name: Production Deploy - if: github.event_name == 'push' && env.BRANCH_NAME == 'master' - uses: nwtgck/actions-netlify@v1.1 - with: - publish-dir: './docs/.vuepress/dist' - production-branch: ${{ env.BRANCH_NAME }} - production-deploy: true - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: 'Production Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}' - - name: Deploy to Netlify uses: nwtgck/actions-netlify@v1.1 with: publish-dir: './docs/.vuepress/dist' - production-branch: ${{ env.BRANCH_NAME }} + production-branch: master github-token: ${{ secrets.GITHUB_TOKEN }} deploy-message: 'Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}' env: From 3cc738c205184e039777cfd26ce47e38154a1051 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 10 Feb 2021 13:53:41 +0800 Subject: [PATCH 14/14] :construction_worker: update ci --- .github/workflows/site_deploy.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 3065604e..cb0bce3c 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -32,6 +32,14 @@ jobs: - name: Get Branch Name run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + - name: Get Deploy Name + if: github.event_name == 'push' + run: echo "DEPLOY_NAME=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV + + - name: Get Deploy Name + if: github.event_name != 'push' + run: echo "DEPLOY_NAME=deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV + - name: Deploy to Netlify uses: nwtgck/actions-netlify@v1.1 with: @@ -39,6 +47,7 @@ jobs: production-branch: master github-token: ${{ secrets.GITHUB_TOKEN }} deploy-message: 'Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}' + alias: ${{ env.DEPLOY_NAME }} env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}