From 6575232f228744580ff536cac521a70898c01598 Mon Sep 17 00:00:00 2001 From: FairyEver <1711467488@qq.com> Date: Sun, 15 Dec 2019 00:17:34 +0800 Subject: [PATCH] deploy --- .github/workflows/deploy-cdn.yml | 50 +++++++++++++++++++ .../{deploy-test.yml => deploy-d2.yml} | 7 +-- .github/workflows/deploy-github.yml | 21 ++++++++ .github/workflows/feedback.yml | 17 +++++++ .github/workflows/star.yml | 17 +++++++ 5 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/deploy-cdn.yml rename .github/workflows/{deploy-test.yml => deploy-d2.yml} (81%) create mode 100644 .github/workflows/deploy-github.yml create mode 100644 .github/workflows/feedback.yml create mode 100644 .github/workflows/star.yml diff --git a/.github/workflows/deploy-cdn.yml b/.github/workflows/deploy-cdn.yml new file mode 100644 index 00000000..4e5a4ff5 --- /dev/null +++ b/.github/workflows/deploy-cdn.yml @@ -0,0 +1,50 @@ +name: Deploy cdn + +on: + push: + branches: + - master + +env: + SITE: https://cdn.d2.pub/ + QINIU_BUCKET: d2-cdn + 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:preview + - name: CDN login + run: ./qshell account ${{ secrets.AK }} ${{ secrets.SK }} GITHUB_ACTION + - name: CDN upload + run: | + REPO=${GITHUB_REPOSITORY//*\//} + echo $SITE > 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 \ + --thread-count=32 + - name: CDN refresh + run: ./qshell cdnrefresh --dirs -i ./cdnrefresh.txt \ No newline at end of file diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-d2.yml similarity index 81% rename from .github/workflows/deploy-test.yml rename to .github/workflows/deploy-d2.yml index 247cb03b..5a2c197c 100644 --- a/.github/workflows/deploy-test.yml +++ b/.github/workflows/deploy-d2.yml @@ -8,9 +8,6 @@ on: jobs: build: runs-on: ubuntu-latest - env: - LOCAL_DIR: dist - REMOTE_DIR: /www/d2-admin/preview steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 @@ -28,6 +25,6 @@ jobs: FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} METHOD: sftp PORT: ${{ secrets.FTP_PORT }} - LOCAL_DIR: ${{ LOCAL_DIR }} - REMOTE_DIR: ${{ REMOTE_DIR }} + LOCAL_DIR: dist + REMOTE_DIR: /www/d2-admin/preview ARGS: --delete --verbose --parallel=100 \ No newline at end of file diff --git a/.github/workflows/deploy-github.yml b/.github/workflows/deploy-github.yml new file mode 100644 index 00000000..5c93e9c8 --- /dev/null +++ b/.github/workflows/deploy-github.yml @@ -0,0 +1,21 @@ +name: Deploy Github + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Build and Deploy + uses: JamesIves/github-pages-deploy-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH: gh-pages + FOLDER: dist + BUILD_SCRIPT: npm install && npm run build:github + CLEAN: true \ No newline at end of file diff --git a/.github/workflows/feedback.yml b/.github/workflows/feedback.yml new file mode 100644 index 00000000..3048c48b --- /dev/null +++ b/.github/workflows/feedback.yml @@ -0,0 +1,17 @@ +name: Feedback +on: [fork, watch, issues] +jobs: + feedback: + runs-on: ubuntu-latest + steps: + - name: feedback + id: feedback + uses: d2-projects/repo-email-feedback@v1.3 + with: + username: ${{ secrets.FEEDBACK_USERNAME }} + sign: ${{ secrets.FEEDBACK_SIGN }} + wxpusher: ${{ secrets.FEEDBACK_WXPUSHER_UID }} + template: ${{ github.repository }} + repo: ${{ github.repository }} + actor: ${{ github.actor }} + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/star.yml b/.github/workflows/star.yml new file mode 100644 index 00000000..66cce45f --- /dev/null +++ b/.github/workflows/star.yml @@ -0,0 +1,17 @@ +name: Star notice + +on: + watch: + types: [started] + +jobs: + bark: + + runs-on: ubuntu-latest + + steps: + - name: send bark message + run: | + repo=${GITHUB_REPOSITORY//\//:} + actor=$GITHUB_ACTOR + curl https://api.day.app/EweNWLE36rvVR8EFfWGq7k/$actor%20star%20了你的仓库/$repo \ No newline at end of file