From 775bf6b61a5c069907c738d375e3a6639275ce22 Mon Sep 17 00:00:00 2001 From: FairyEver <1711467488@qq.com> Date: Sat, 7 Dec 2019 13:48:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=20CI=20=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: d5bd43f2db3d5747dfe40aed1357bec7c6873ad9 --- .github/workflows/deploy.yml | 50 ++++++++++++++++++++++++++++++++++++ .github/workflows/qiniu.yml | 31 ---------------------- deploy/cdnrefresh.txt | 1 - deploy/qshell.REMOVED.git-id | 1 - 4 files changed, 50 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/qiniu.yml delete mode 100644 deploy/cdnrefresh.txt delete mode 100644 deploy/qshell.REMOVED.git-id diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e0bbf75 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,50 @@ +name: Build and upload to qiniu CDN + +on: + push: + branches: + - master + +env: + SITE: https://fairyever.com/ + QINIU_BUCKET: fairyever-site + DIST_FOLDER: /dist + PATH_SUFFIX: /preview + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '10.x' + - name: Download qshell + run: | + wget http://devtools.qiniu.com/qshell-linux-x86-v2.4.0.zip + unzip qshell-linux-x86-v2.4.0.zip + mv qshell-linux-x86-v2.4.0 qshell + - name: Install packages + run: npm i + - name: Build + run: npm run build:github + - name: CDN login + run: ./qshell account ${{ secrets.AK }} ${{ secrets.SK }} GITHUB_ACTION + - name: CDN upload + run: | + REPO=${GITHUB_REPOSITORY//*\//} + REFRESH_URL=$SITE$REPO$PATH_SUFFIX/ + echo $REFRESH_URL > cdnrefresh.txt + ./qshell qupload2\ + --src-dir=$GITHUB_WORKSPACE$DIST_FOLDER\ + --bucket=$QINIU_BUCKET\ + --key-prefix=$REPO$PATH_SUFFIX/\ + --overwrite=true\ + --check-exists=true\ + --check-hash=true\ + --check-size=true\ + --rescan-local=true + - name: CDN refresh + run: ./qshell cdnrefresh --dirs -i ./cdnrefresh.txt \ No newline at end of file diff --git a/.github/workflows/qiniu.yml b/.github/workflows/qiniu.yml deleted file mode 100644 index dfee4fc..0000000 --- a/.github/workflows/qiniu.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Build and upload to qiniu CDN - -on: - push: - branches: - - master - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '10.x' - - name: install packages - run: npm i - - name: build - run: npm run build:github - - name: qiniu login - run: ./deploy/qshell account ${{ secrets.AK }} ${{ secrets.SK }} liyang - - name: qiniu upload - run: | - dist=$GITHUB_WORKSPACE/dist - bucket=fairyever-site - prefix=d2-admin-start-kit/preview/ - ./deploy/qshell qupload2 --src-dir=$dist --bucket=$bucket --key-prefix=$prefix --overwrite=true --check-exists=true --check-hash=true --check-size=true --rescan-local=true - - name: refresn CDN - run: ./deploy/qshell cdnrefresh --dirs -i ./deploy/cdnrefresh.txt \ No newline at end of file diff --git a/deploy/cdnrefresh.txt b/deploy/cdnrefresh.txt deleted file mode 100644 index a515bd6..0000000 --- a/deploy/cdnrefresh.txt +++ /dev/null @@ -1 +0,0 @@ -https://fairyever.com/d2-admin-start-kit/preview/ \ No newline at end of file diff --git a/deploy/qshell.REMOVED.git-id b/deploy/qshell.REMOVED.git-id deleted file mode 100644 index e495bb3..0000000 --- a/deploy/qshell.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -29e14e12928a32ad4318cf1670ef695e5a3379c6 \ No newline at end of file