From b264952a27aca9e0dba3860a70d6e8112ee58511 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 20:22:42 +0800 Subject: [PATCH 01/11] fix: test-ci --- .github/workflows/dev-latest.yml | 4 ++-- .github/workflows/docker.yml | 4 ++-- .gitignore | 17 ++++++++--------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dev-latest.yml b/.github/workflows/dev-latest.yml index eed5d029..7b85088d 100644 --- a/.github/workflows/dev-latest.yml +++ b/.github/workflows/dev-latest.yml @@ -19,10 +19,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f backend/requirements-dev.txt ]; then pip install -r backend/requirements-dev.txt; fi pip install pytest - name: Test - working-directory: ./src + working-directory: ./backend/src run: | mkdir -p config pytest diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 110b0185..c641c6b3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,10 +19,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f backend/requirements.txt ]; then pip install -r backend/requirements.txt; fi pip install pytest - name: Test - working-directory: ./src + working-directory: .backend/src run: | mkdir -p config pytest diff --git a/.gitignore b/.gitignore index f6222a65..dff85d3d 100644 --- a/.gitignore +++ b/.gitignore @@ -162,18 +162,17 @@ cython_debug/ #.idea/ # Custom -/src/test.py +/backend/src/test.py -/src/module/run_debug.sh -/src/module/debug_run.sh -/src/module/__version__.py -/src/data/ +/backend/src/module/run_debug.sh +/backend/src/module/debug_run.sh +/backend/src/module/__version__.py +/backend/src/data/ /src/module/conf/config_dev.ini test.* .run -/src/templates/ -/src/config/ -/src/debuger.py -/src/dist.zip +/backend/src/templates/ +/backend/src/config/ +/backend/src/dist.zip From bf73dfbc0f0508e4c0ffd563aa55f9987c55c435 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 20:24:12 +0800 Subject: [PATCH 02/11] fix: fix ci path problem --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c641c6b3..efd55f25 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -22,7 +22,7 @@ jobs: if [ -f backend/requirements.txt ]; then pip install -r backend/requirements.txt; fi pip install pytest - name: Test - working-directory: .backend/src + working-directory: ./backend/src run: | mkdir -p config pytest From 24f63a7df80b9d79e0a7823f2bdbd44d63d11348 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 20:26:20 +0800 Subject: [PATCH 03/11] fix: fix Dockerfile path problem --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f58121f..72de73c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ENV S6_SERVICES_GRACETIME=30000 \ WORKDIR /app -COPY requirements.txt . +COPY backend/requirements.txt . RUN apk add --no-cache \ bash \ ca-certificates \ @@ -45,8 +45,8 @@ RUN apk add --no-cache \ /root/.cache \ /tmp/* -COPY --chmod=755 src/. . -COPY --chmod=755 src/docker / +COPY --chmod=755 backend/src/. . +COPY --chmod=755 backend/src/docker / ENTRYPOINT [ "/init" ] From fd160599fb88efc58afe2baf5e4e07cef22373e3 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 20:28:22 +0800 Subject: [PATCH 04/11] fix: version path in ci --- .github/workflows/dev-latest.yml | 2 +- .github/workflows/docker.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-latest.yml b/.github/workflows/dev-latest.yml index 7b85088d..30b7d5dd 100644 --- a/.github/workflows/dev-latest.yml +++ b/.github/workflows/dev-latest.yml @@ -34,7 +34,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Create Version info - working-directory: ./src + working-directory: ./backend/src run: | echo "VERSION = '$GITHUB_REF_NAME'" > module/__version__.py diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index efd55f25..628420be 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -35,7 +35,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Create Version info - working-directory: ./src + working-directory: ./backend/src run: | echo "VERSION = '$GITHUB_REF_NAME'" > module/__version__.py From 77579a5a9c4d73c8457d84eadef2e10dcbe58400 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 21:01:28 +0800 Subject: [PATCH 05/11] feat: add build webui into ci. Change Dockerfile, add webui in release draft. --- .github/workflows/dev-latest.yml | 37 ++++++++++++++++- .github/workflows/docker.yml | 70 ++++++++++++++++++++++++++++++-- Dockerfile | 6 +-- 3 files changed, 106 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev-latest.yml b/.github/workflows/dev-latest.yml index 30b7d5dd..c8247914 100644 --- a/.github/workflows/dev-latest.yml +++ b/.github/workflows/dev-latest.yml @@ -27,7 +27,36 @@ jobs: mkdir -p config pytest - dev-latest: + build-webui: + runs-on: ubuntu-latest + needs: [test] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: latest + + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: latest + run_install: true + + - name: Build + run: pnpm build && zip -r dist.zip dist + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist.zip + + + dev-build: runs-on: ubuntu-latest needs: [test] steps: @@ -44,6 +73,12 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: dist + path: dist.zip + - name: Docker metadata id: meta uses: docker/metadata-action@v4 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 628420be..b60e8da6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -26,19 +26,77 @@ jobs: run: | mkdir -p config pytest - - build: + build-webui: runs-on: ubuntu-latest needs: [test] steps: - name: Checkout uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: latest + + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: latest + run_install: true + + - name: Build + run: pnpm build && zip -r dist.zip dist + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist.zip + + + draft-release: + runs-on: ubuntu-latest + needs: [test] + if: > + github.event.pull_request.merged == true && + github.event.pull_request.base.ref == 'main' + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: download artifact + uses: actions/download-artifact@v3 + with: + name: dist + path: dist.zip + + - name: Generate Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.event.pull_request.title }} + name: 🌟${{ github.event.pull_request.title }} + body: ${{ github.event.pull_request.body }} + draft: true + prerelease: false + files: | + dist.zip + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + + build-docker: + runs-on: ubuntu-latest + needs: [test] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Create Version info working-directory: ./backend/src run: | echo "VERSION = '$GITHUB_REF_NAME'" > module/__version__.py - - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -46,6 +104,12 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 + - name: download artifact + uses: actions/download-artifact@v3 + with: + name: dist + path: dist.zip + - name: Docker metadata id: meta uses: docker/metadata-action@v4 diff --git a/Dockerfile b/Dockerfile index 72de73c7..e380e5bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ ENV S6_SERVICES_GRACETIME=30000 \ WORKDIR /app COPY backend/requirements.txt . +COPY dist.zip . RUN apk add --no-cache \ bash \ ca-certificates \ @@ -34,9 +35,8 @@ RUN apk add --no-cache \ python3 -m pip install --upgrade pip && \ sed -i '/bcrypt/d' requirements.txt && \ pip install --no-cache-dir -r requirements.txt && \ - # Download WebUI - curl -sL "https://github.com/Rewrite0/Auto_Bangumi_WebUI/releases/latest/download/dist.zip" | busybox unzip -q -d /app - && \ - mv /app/dist /app/templates && \ + # Unzip WebUI \ + unzip dist.zip -d /app/templates && \ # Add user addgroup -S ab -g 911 && \ adduser -S ab -G ab -h /ab -s /bin/bash -u 911 && \ From 13aae00a9f711bcacb53360a3c330ff62a2c2921 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 21:04:49 +0800 Subject: [PATCH 06/11] feat: Add needs in Build docker, Add Path in Build webui --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b60e8da6..1ad92fb5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -39,6 +39,9 @@ jobs: with: node-version: latest + - name: CD into path + run: cd webui + - uses: pnpm/action-setup@v2 name: Install pnpm id: pnpm-install @@ -88,7 +91,7 @@ jobs: build-docker: runs-on: ubuntu-latest - needs: [test] + needs: [test, build-webui] steps: - name: Checkout uses: actions/checkout@v3 From b70fe6e28b93d3ce485d7f13adb561473b106586 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 21:07:59 +0800 Subject: [PATCH 07/11] fix: path problem --- .github/workflows/docker.yml | 9 ++--- .../workflows/create-release-draft.yaml | 39 ------------------- 2 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 webui/.github/workflows/create-release-draft.yaml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1ad92fb5..5da86bec 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -39,9 +39,6 @@ jobs: with: node-version: latest - - name: CD into path - run: cd webui - - uses: pnpm/action-setup@v2 name: Install pnpm id: pnpm-install @@ -50,13 +47,15 @@ jobs: run_install: true - name: Build - run: pnpm build && zip -r dist.zip dist + run: | + cd webui + pnpm build && zip -r dist.zip dist - name: Upload artifact uses: actions/upload-artifact@v3 with: name: dist - path: dist.zip + path: webui/dist.zip draft-release: diff --git a/webui/.github/workflows/create-release-draft.yaml b/webui/.github/workflows/create-release-draft.yaml deleted file mode 100644 index 329d89aa..00000000 --- a/webui/.github/workflows/create-release-draft.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Create Release Draft - -on: - push: - tags: - - 'v*.*.*' - -permissions: - contents: write - discussions: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: latest - - - uses: pnpm/action-setup@v2 - name: Install pnpm - id: pnpm-install - with: - version: latest - run_install: true - - - name: Build - run: pnpm build && zip -r dist.zip dist - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - draft: true - files: dist.zip From c0d6658bb729bd0f4b563872a9d88a6b4908e815 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 21:23:25 +0800 Subject: [PATCH 08/11] fix: fix artifact --- .github/workflows/dev-latest.yml | 7 ++++--- .github/workflows/docker.yml | 11 +++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dev-latest.yml b/.github/workflows/dev-latest.yml index c8247914..9fcc97af 100644 --- a/.github/workflows/dev-latest.yml +++ b/.github/workflows/dev-latest.yml @@ -47,13 +47,15 @@ jobs: run_install: true - name: Build - run: pnpm build && zip -r dist.zip dist + run: | + cd webui + pnpm build && zip -r dist.zip dist - name: Upload artifact uses: actions/upload-artifact@v3 with: name: dist - path: dist.zip + path: webui/dist.zip dev-build: @@ -77,7 +79,6 @@ jobs: uses: actions/download-artifact@v2 with: name: dist - path: dist.zip - name: Docker metadata id: meta diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5da86bec..4f20c7e1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -106,12 +106,6 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 - - name: download artifact - uses: actions/download-artifact@v3 - with: - name: dist - path: dist.zip - - name: Docker metadata id: meta uses: docker/metadata-action@v4 @@ -139,6 +133,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.ACCESS_TOKEN }} + - name: download artifact + uses: actions/download-artifact@v3 + with: + name: dist + - name: Build and push uses: docker/build-push-action@v4 with: From 33495cb720f6446b517849f2b5bfba26a62099a1 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 21:26:01 +0800 Subject: [PATCH 09/11] fix: fix artifact --- .github/workflows/dev-latest.yml | 4 ++-- .github/workflows/docker.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev-latest.yml b/.github/workflows/dev-latest.yml index 9fcc97af..93a6883d 100644 --- a/.github/workflows/dev-latest.yml +++ b/.github/workflows/dev-latest.yml @@ -54,7 +54,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: dist + name: dist.zip path: webui/dist.zip @@ -78,7 +78,7 @@ jobs: - name: Download artifact uses: actions/download-artifact@v2 with: - name: dist + name: dist.zip - name: Docker metadata id: meta diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4f20c7e1..2e71185e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -72,7 +72,7 @@ jobs: - name: download artifact uses: actions/download-artifact@v3 with: - name: dist + name: dist.zip path: dist.zip - name: Generate Release @@ -136,7 +136,7 @@ jobs: - name: download artifact uses: actions/download-artifact@v3 with: - name: dist + name: dist.zip - name: Build and push uses: docker/build-push-action@v4 From e13b9f046b0ddbd490f4c994b584a0ac646f1d8d Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 21:31:31 +0800 Subject: [PATCH 10/11] fix: --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2e71185e..7e97d16f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -54,7 +54,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: dist + name: dist.zip path: webui/dist.zip @@ -133,7 +133,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.ACCESS_TOKEN }} - - name: download artifact + - name: Download artifact uses: actions/download-artifact@v3 with: name: dist.zip From 86a6ece51057fdd2e72ac0e1138fcf8ce86ffdfe Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 7 Jun 2023 21:36:41 +0800 Subject: [PATCH 11/11] fix: --- .github/workflows/docker.yml | 7 ++++--- Dockerfile | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7e97d16f..79f38562 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -54,7 +54,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: dist.zip + name: dist path: webui/dist.zip @@ -72,7 +72,7 @@ jobs: - name: download artifact uses: actions/download-artifact@v3 with: - name: dist.zip + name: dist path: dist.zip - name: Generate Release @@ -136,7 +136,8 @@ jobs: - name: Download artifact uses: actions/download-artifact@v3 with: - name: dist.zip + name: dist + path: backend/dist.zip - name: Build and push uses: docker/build-push-action@v4 diff --git a/Dockerfile b/Dockerfile index e380e5bf..9e0f62d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ENV S6_SERVICES_GRACETIME=30000 \ WORKDIR /app COPY backend/requirements.txt . -COPY dist.zip . +COPY backend/dist.zip . RUN apk add --no-cache \ bash \ ca-certificates \