From 22b870bea646ca539a5f0f83167cf9a1e44f9cec Mon Sep 17 00:00:00 2001 From: hemengyang Date: Wed, 18 May 2022 10:08:35 +0000 Subject: [PATCH 01/16] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=B8=8E=E8=A6=86=E7=9B=96=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codecov.yml | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..ecab769 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,40 @@ +name: Code Coverage + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + name: Test Coverage + runs-on: ${{ matrix.os }} + concurrency: + group: test-coverage-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }} + cancel-in-progress: true + strategy: + matrix: + python-version: ["3.9", "3.10"] + os: [ubuntu-latest, windows-latest, macos-latest] + fail-fast: false + env: + OS: ${{ matrix.os }} + PYTHON_VERSION: ${{ matrix.python-version }} + + steps: + - uses: actions/checkout@v3 + + - name: Setup Python environment + uses: he0119/setup-python@v0.1.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Run Pytest + run: poetry run pytest --cov-report xml --cov=./src/plugins/nonebot_bison -k 'not compare and not render' + - name: Upload coverage report + uses: codecov/codecov-action@v3 + with: + env_vars: OS,PYTHON_VERSION + files: ./tests/coverage.xml + flags: unittests From 2fa0fef856cae4957d6ed5d9e706ff7b2edde7f6 Mon Sep 17 00:00:00 2001 From: hemengyang Date: Wed, 18 May 2022 10:10:48 +0000 Subject: [PATCH 02/16] =?UTF-8?q?fix:=20=E5=8A=A0=E4=B8=8A=E5=BF=98?= =?UTF-8?q?=E8=AE=B0=E7=9A=84=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codecov.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index ecab769..3969223 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -29,9 +29,13 @@ jobs: uses: he0119/setup-python@v0.1.0 with: python-version: ${{ matrix.python-version }} + + - name: Install prerequisites + run: poetry install - name: Run Pytest run: poetry run pytest --cov-report xml --cov=./src/plugins/nonebot_bison -k 'not compare and not render' + - name: Upload coverage report uses: codecov/codecov-action@v3 with: From 42029ef2dd6a206078eec6d01772e6ce90e6c8b7 Mon Sep 17 00:00:00 2001 From: hemengyang Date: Wed, 18 May 2022 10:22:37 +0000 Subject: [PATCH 03/16] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=20codecov=20=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codecov.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 3969223..9c10516 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -40,5 +40,3 @@ jobs: uses: codecov/codecov-action@v3 with: env_vars: OS,PYTHON_VERSION - files: ./tests/coverage.xml - flags: unittests From 0bd11b48bc0881ba832f8d31b4da14369079e3cf Mon Sep 17 00:00:00 2001 From: hemengyang Date: Wed, 18 May 2022 13:08:25 +0000 Subject: [PATCH 04/16] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E7=94=9F?= =?UTF-8?q?=E6=88=90=20Frontend=20=E7=9A=84=20Action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/setup-node/action.yml | 18 ++++++++++++++++++ .github/workflows/codecov.yml | 27 ++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/actions/setup-node/action.yml diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 0000000..0286424 --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,18 @@ +name: Setup Node +description: Setup Node + +runs: + using: "composite" + steps: + - uses: actions/setup-node@v2 + with: + node-version: "16" + + - id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + shell: bash + + - uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 9c10516..f6f3e06 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -29,7 +29,7 @@ jobs: uses: he0119/setup-python@v0.1.0 with: python-version: ${{ matrix.python-version }} - + - name: Install prerequisites run: poetry install @@ -40,3 +40,28 @@ jobs: uses: codecov/codecov-action@v3 with: env_vars: OS,PYTHON_VERSION + + build-frontend: + name: Build Frontend + runs-on: ubuntu-latest + concurrency: + group: build-frontend-${{ github.ref }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v3 + + - name: Setup Node Environment + uses: ./.github/actions/setup-node + + - name: Build Frontend + run: | + cd ./admin-frontend + yarn install + yarn build + + - name: Upload dist + uses: actions/upload-artifact@v3 + with: + name: frontend + path: ${{ github.workspace }}/admin-frontend/build/ From 977d45bfbb0ab010e4c80cc43344dc2966f33f45 Mon Sep 17 00:00:00 2001 From: hemengyang Date: Wed, 18 May 2022 13:22:18 +0000 Subject: [PATCH 05/16] =?UTF-8?q?fix:=20=E9=9C=80=E8=A6=81=E5=85=88?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=89=8D=E7=AB=AF=E5=86=8D=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/build-frontend/action.yml | 15 +++++++ .github/workflows/codecov.yml | 51 ++++++++++++----------- 2 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 .github/actions/build-frontend/action.yml diff --git a/.github/actions/build-frontend/action.yml b/.github/actions/build-frontend/action.yml new file mode 100644 index 0000000..aa39679 --- /dev/null +++ b/.github/actions/build-frontend/action.yml @@ -0,0 +1,15 @@ +name: Build Frontend +description: Build Frontend + +runs: + using: "composite" + steps: + - name: Setup Node Environment + uses: ./.github/actions/setup-node + + - name: Build Frontend + shell: bash + working-directory: ./admin-frontend + run: | + yarn install + yarn build diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index f6f3e06..8760da4 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -7,9 +7,29 @@ on: pull_request: jobs: + build-frontend: + name: Build Frontend + runs-on: ubuntu-latest + concurrency: + group: build-frontend-${{ github.ref }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v3 + + - name: Build Frontend + uses: ./.github/actions/build-frontend + + - name: Upload dist + uses: actions/upload-artifact@v3 + with: + name: frontend + path: ./admin-frontend/build/ + test: name: Test Coverage runs-on: ${{ matrix.os }} + needs: build-frontend concurrency: group: test-coverage-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }} cancel-in-progress: true @@ -25,6 +45,12 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Download frontend files + uses: actions/download-artifact@v2 + with: + name: frontend + path: ./src/plugins/nonebot_bison/admin_page/dist + - name: Setup Python environment uses: he0119/setup-python@v0.1.0 with: @@ -40,28 +66,3 @@ jobs: uses: codecov/codecov-action@v3 with: env_vars: OS,PYTHON_VERSION - - build-frontend: - name: Build Frontend - runs-on: ubuntu-latest - concurrency: - group: build-frontend-${{ github.ref }} - cancel-in-progress: true - - steps: - - uses: actions/checkout@v3 - - - name: Setup Node Environment - uses: ./.github/actions/setup-node - - - name: Build Frontend - run: | - cd ./admin-frontend - yarn install - yarn build - - - name: Upload dist - uses: actions/upload-artifact@v3 - with: - name: frontend - path: ${{ github.workspace }}/admin-frontend/build/ From 743d863e13b94d9a5ff190ca085d3a172d343c5d Mon Sep 17 00:00:00 2001 From: hemengyang Date: Wed, 18 May 2022 14:10:06 +0000 Subject: [PATCH 06/16] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=20Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codecov.yml | 47 ++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 8760da4..669fadb 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -25,7 +25,6 @@ jobs: with: name: frontend path: ./admin-frontend/build/ - test: name: Test Coverage runs-on: ${{ matrix.os }} @@ -66,3 +65,49 @@ jobs: uses: codecov/codecov-action@v3 with: env_vars: OS,PYTHON_VERSION + docker: + name: Docker + runs-on: ubuntu-latest + needs: [build-frontend, test] + + steps: + - uses: actions/checkout@v3 + + - name: Download frontend files + uses: actions/download-artifact@v2 + with: + name: frontend + path: ./src/plugins/nonebot_bison/admin_page/dist + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./docker/Dockerfile_with_frontend + push: ${{ github.event_name != 'pull_request' }} + tags: felinae98/nonebot-bison:main + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build Sentry and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./docker/Dockerfile_with_frontend_sentry + push: ${{ github.event_name != 'pull_request' }} + tags: felinae98/nonebot-bison:main-sentry + cache-from: type=gha + cache-to: type=gha,mode=max From 024fcda219db241f1cdf8b15dc3786f7fa042c7f Mon Sep 17 00:00:00 2001 From: hemengyang Date: Wed, 18 May 2022 14:34:03 +0000 Subject: [PATCH 07/16] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=87=B3=20PyPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/setup-python/action.yml | 40 +++++++++++++++++++++ .github/workflows/{codecov.yml => main.yml} | 4 +-- .github/workflows/release.yml | 38 ++++++++++++++++++++ 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .github/actions/setup-python/action.yml rename .github/workflows/{codecov.yml => main.yml} (98%) create mode 100644 .github/workflows/release.yml diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml new file mode 100644 index 0000000..9c14210 --- /dev/null +++ b/.github/actions/setup-python/action.yml @@ -0,0 +1,40 @@ +name: Setup Python +description: Setup Python + +inputs: + python-version: + description: Python version + required: false + default: "3.9" + +runs: + using: "composite" + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ inputs.python-version }} + + - name: Install poetry + uses: Gr1N/setup-poetry@v7 + + - name: Cache Windows dependencies + uses: actions/cache@v2 + if: ${{ runner.os == 'Windows' }} + with: + path: ~/AppData/Local/pypoetry/Cache/virtualenvs + key: ${{ runner.os }}-poetry-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Cache Linux dependencies + uses: actions/cache@v2 + if: ${{ runner.os == 'Linux' }} + with: + path: ~/.cache/pypoetry/virtualenvs + key: ${{ runner.os }}-poetry-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Cache macOS dependencies + uses: actions/cache@v2 + if: ${{ runner.os == 'macOS' }} + with: + path: ~/Library/Caches/pypoetry/virtualenvs + key: ${{ runner.os }}-poetry-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }} \ No newline at end of file diff --git a/.github/workflows/codecov.yml b/.github/workflows/main.yml similarity index 98% rename from .github/workflows/codecov.yml rename to .github/workflows/main.yml index 669fadb..f37f954 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Code Coverage +name: CI on: push: @@ -51,7 +51,7 @@ jobs: path: ./src/plugins/nonebot_bison/admin_page/dist - name: Setup Python environment - uses: he0119/setup-python@v0.1.0 + uses: ./.github/actions/setup-python with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d5990e1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + release: + types: [published] + +jobs: + build-frontend: + name: Build Frontend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Build Frontend + uses: ./.github/actions/build-frontend + + - name: Upload dist + uses: actions/upload-artifact@v3 + with: + name: frontend + path: ./admin-frontend/build/ + publish-pypi: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Download frontend files + uses: actions/download-artifact@v2 + with: + name: frontend + path: ./src/plugins/nonebot_bison/admin_page/dist + + - name: Setup Python environment + uses: ./.github/actions/setup-python + + - name: Publish PyPI + run: poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi" From 5957ac97192df81e37f6241b2c216c093e4b7907 Mon Sep 17 00:00:00 2001 From: hemengyang Date: Thu, 19 May 2022 12:18:59 +0000 Subject: [PATCH 08/16] =?UTF-8?q?ci:=20=E5=8A=A0=E4=B8=8A=20Docker=20?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5990e1..756d95a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,7 @@ jobs: path: ./admin-frontend/build/ publish-pypi: runs-on: ubuntu-latest + needs: build-frontend steps: - uses: actions/checkout@v3 @@ -36,3 +37,50 @@ jobs: - name: Publish PyPI run: poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi" + publish-docker: + runs-on: ubuntu-latest + needs: build-frontend + + steps: + - uses: actions/checkout@v3 + + - name: Download frontend files + uses: actions/download-artifact@v2 + with: + name: frontend + path: ./src/plugins/nonebot_bison/admin_page/dist + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./docker/Dockerfile_with_frontend + push: true + tags: | + felinae98/nonebot-bison:latest + felinae98/nonebot-bison:${{ github.event.release.tag_name }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build Sentry and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./docker/Dockerfile_with_frontend_sentry + push: true + tags: felinae98/nonebot-bison:${{ github.event.release.tag_name }}-sentry + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file From b2845f78677d90ea3a20d769c42c066d6aeb137d Mon Sep 17 00:00:00 2001 From: hemengyang Date: Thu, 19 May 2022 12:33:10 +0000 Subject: [PATCH 09/16] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=96=87=E6=A1=A3=E7=BD=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 26 +++++++++++++++++- .github/workflows/website-preview.yml | 39 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/website-preview.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 756d95a..b715966 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,4 +83,28 @@ jobs: push: true tags: felinae98/nonebot-bison:${{ github.event.release.tag_name }}-sentry cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-to: type=gha,mode=max + deploy-web: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Node Environment + uses: ./.github/actions/setup-node + + - name: Build Docs + run: yarn docs:build + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1 + with: + publish-dir: "./docs/.vuepress/dist" + production-deploy: true + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy ${{ github.event.release.tag_name }}" + enable-commit-comment: false + alias: ${{ github.event.release.tag_name }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/.github/workflows/website-preview.yml b/.github/workflows/website-preview.yml new file mode 100644 index 0000000..f6fcbff --- /dev/null +++ b/.github/workflows/website-preview.yml @@ -0,0 +1,39 @@ +name: Site Deploy(Preview) + +on: + pull_request_target: + +jobs: + preview: + runs-on: ubuntu-latest + concurrency: + group: pull-request-preview-${{ github.event.number }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Setup Node Environment + uses: ./.github/actions/setup-node + + - name: Build Docs + run: yarn docs:build + + - name: Get Deploy Name + run: | + echo "DEPLOY_NAME=deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1 + with: + publish-dir: "./docs/.vuepress/dist" + production-deploy: false + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}" + enable-commit-comment: false + alias: ${{ env.DEPLOY_NAME }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} From 052018c4623aa06d22ba13b549e5c7f796f26180 Mon Sep 17 00:00:00 2001 From: hemengyang Date: Thu, 19 May 2022 12:39:17 +0000 Subject: [PATCH 10/16] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=BF=98?= =?UTF-8?q?=E8=AE=B0=E7=9A=84=20install?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/build-docs/action.yml | 14 ++++++++++++++ .github/workflows/release.yml | 5 +---- .github/workflows/website-preview.yml | 5 +---- 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .github/actions/build-docs/action.yml diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml new file mode 100644 index 0000000..5a296a3 --- /dev/null +++ b/.github/actions/build-docs/action.yml @@ -0,0 +1,14 @@ +name: Build Docs +description: Build Docs + +runs: + using: "composite" + steps: + - name: Setup Node Environment + uses: ./.github/actions/setup-node + + - name: Build Frontend + shell: bash + run: | + yarn install + yarn docs:build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b715966..8f56ca9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,11 +90,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup Node Environment - uses: ./.github/actions/setup-node - - name: Build Docs - run: yarn docs:build + uses: ./.github/actions/build-docs - name: Deploy to Netlify uses: nwtgck/actions-netlify@v1 diff --git a/.github/workflows/website-preview.yml b/.github/workflows/website-preview.yml index f6fcbff..d6946b3 100644 --- a/.github/workflows/website-preview.yml +++ b/.github/workflows/website-preview.yml @@ -15,11 +15,8 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Setup Node Environment - uses: ./.github/actions/setup-node - - name: Build Docs - run: yarn docs:build + uses: ./.github/actions/build-docs - name: Get Deploy Name run: | From 52ba6eae4c7554b5909dd2bd72ca6f9273201578 Mon Sep 17 00:00:00 2001 From: hemengyang Date: Thu, 19 May 2022 12:47:05 +0000 Subject: [PATCH 11/16] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4=20main=20?= =?UTF-8?q?=E7=9A=84=E5=B9=B6=E5=8F=91=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f37f954..b5cc8e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,13 +6,14 @@ on: - main pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build-frontend: name: Build Frontend runs-on: ubuntu-latest - concurrency: - group: build-frontend-${{ github.ref }} - cancel-in-progress: true steps: - uses: actions/checkout@v3 @@ -29,9 +30,6 @@ jobs: name: Test Coverage runs-on: ${{ matrix.os }} needs: build-frontend - concurrency: - group: test-coverage-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }} - cancel-in-progress: true strategy: matrix: python-version: ["3.9", "3.10"] From f2d7e9b54177429f7bfcddb7b1ba0bdbc4e37bee Mon Sep 17 00:00:00 2001 From: hemengyang Date: Thu, 19 May 2022 12:50:12 +0000 Subject: [PATCH 12/16] =?UTF-8?q?ci:=20=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E4=B8=8A=E4=BC=A0=E8=87=B3=20Release=20Asset?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f56ca9..323c67b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,6 +37,13 @@ jobs: - name: Publish PyPI run: poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi" + + - name: Upload Release Assets + uses: alexellis/upload-assets@0.2.3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + asset_paths: '["./dist/*"]' publish-docker: runs-on: ubuntu-latest needs: build-frontend From 8ea7841e49580fa98e94675abc32ebfa02efdc3f Mon Sep 17 00:00:00 2001 From: hemengyang Date: Fri, 20 May 2022 04:04:21 +0000 Subject: [PATCH 13/16] =?UTF-8?q?ci:=20=E5=B0=9D=E8=AF=95=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20matrix=20=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5cc8e0..c6d4e5f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,6 +67,13 @@ jobs: name: Docker runs-on: ubuntu-latest needs: [build-frontend, test] + strategy: + matrix: + include: + - file: ./docker/Dockerfile_with_frontend + tags: felinae98/nonebot-bison:main + - file: ./docker/Dockerfile_with_frontend_sentry + tags: felinae98/nonebot-bison:main-sentry steps: - uses: actions/checkout@v3 @@ -94,18 +101,8 @@ jobs: uses: docker/build-push-action@v2 with: context: . - file: ./docker/Dockerfile_with_frontend + file: ${{ matrix.file }} push: ${{ github.event_name != 'pull_request' }} - tags: felinae98/nonebot-bison:main - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build Sentry and push - uses: docker/build-push-action@v2 - with: - context: . - file: ./docker/Dockerfile_with_frontend_sentry - push: ${{ github.event_name != 'pull_request' }} - tags: felinae98/nonebot-bison:main-sentry + tags: ${{ matrix.tags }} cache-from: type=gha cache-to: type=gha,mode=max From 272b5b8744d6e92ec562d64d11648f907993d612 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Sat, 21 May 2022 21:05:18 +0800 Subject: [PATCH 14/16] update --- .github/workflows/release-trigger.yml | 35 +++++++++++++++++++++++++++ .github/workflows/release.yml | 24 ++++++++++++------ 2 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release-trigger.yml diff --git a/.github/workflows/release-trigger.yml b/.github/workflows/release-trigger.yml new file mode 100644 index 0000000..8073fb0 --- /dev/null +++ b/.github/workflows/release-trigger.yml @@ -0,0 +1,35 @@ +name: Trigger Release + +on: + workflow_dispatch: + +jobs: + archive: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Python environment + uses: ./.github/actions/setup-python + + - run: echo "TAG_NAME=v$(poetry version -s)" >> $GITHUB_ENV + + - name: Archive Changelog + uses: docker://ghcr.io/nonebot/auto-changelog:master + with: + archive_regex: '(?<=## )最近更新(?=\n)' + archive_title: ${{ env.TAG_NAME }} + commit_and_push: false + + - name: Push Tag + run: | + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + git add . + git commit -m ":bookmark: Release $(poetry version -s)" + git tag ${{ env.TAG_NAME }} + git push && git push --tags diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 323c67b..bc3177f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ name: Release on: - release: - types: [published] + push: + tags: + - v* jobs: build-frontend: @@ -19,7 +20,7 @@ jobs: with: name: frontend path: ./admin-frontend/build/ - publish-pypi: + publish-pypi-github: runs-on: ubuntu-latest needs: build-frontend @@ -38,12 +39,21 @@ jobs: - name: Publish PyPI run: poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi" - - name: Upload Release Assets - uses: alexellis/upload-assets@0.2.3 + - run: | + echo "TAG_NAME=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV" + + - uses: release-drafter/release-drafter@v5 + with: + name: Release ${{ env.TAG_NAME }} + tag: ${{ env.TAG_NAME }} + publish: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - asset_paths: '["./dist/*"]' + + - run: | + gh release upload --clobber ${{ env.TAG_NAME }} dist/* + + publish-docker: runs-on: ubuntu-latest needs: build-frontend From ca51418bf04f89e6d12eb4130cc3b9188e4fbbd4 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Sat, 21 May 2022 21:24:08 +0800 Subject: [PATCH 15/16] add release drafter --- .github/workflows/release-drafter.yml | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..ed5192e --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,39 @@ +name: Release Drafter + +on: + pull_request_target: + branches: + - main + types: + - closed + +jobs: + update-release-drafter: + runs-on: ubuntu-latest + concurrency: + group: pull-request-changelog + cancel-in-progress: true + steps: + - uses: actions/checkout@v3 + + - uses: release-drafter/release-drafter@v5 + id: release-drafter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update Changelog + uses: docker://ghcr.io/nonebot/auto-changelog:master + with: + latest_changes_position: '# Change Log\n\n' + latest_changes_title: '## 最近更新' + replace_regex: '(?<=## 最近更新\n)[\s\S]*?(?=\n## )' + changelog_body: ${{ steps.release-drafter.outputs.body }} + commit_and_push: false + + - name: Commit and Push + run: | + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + git add . + git diff-index --quiet HEAD || git commit -m ":memo: Update changelog" + git push From 1f992bfba3ed866f7b223f32ef1258a0685a0e68 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Sat, 21 May 2022 22:11:19 +0800 Subject: [PATCH 16/16] comment pypi --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc3177f..1e806be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,8 +36,8 @@ jobs: - name: Setup Python environment uses: ./.github/actions/setup-python - - name: Publish PyPI - run: poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi" + # - name: Publish PyPI + # run: poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi" - run: | echo "TAG_NAME=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV"