mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-14 18:41:04 +08:00
Merge pull request #310 from EstrellaXD/ci-fix
This commit is contained in:
44
.github/workflows/dev-latest.yml
vendored
44
.github/workflows/dev-latest.yml
vendored
@@ -19,22 +19,53 @@ 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
|
||||
|
||||
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: |
|
||||
cd webui
|
||||
pnpm build && zip -r dist.zip dist
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist.zip
|
||||
path: webui/dist.zip
|
||||
|
||||
|
||||
dev-build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test]
|
||||
steps:
|
||||
- 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
|
||||
|
||||
@@ -44,6 +75,11 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: dist.zip
|
||||
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
|
||||
78
.github/workflows/docker.yml
vendored
78
.github/workflows/docker.yml
vendored
@@ -19,26 +19,86 @@ 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
|
||||
|
||||
|
||||
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: |
|
||||
cd webui
|
||||
pnpm build && zip -r dist.zip dist
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: webui/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, build-webui]
|
||||
steps:
|
||||
- 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
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
@@ -73,6 +133,12 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: backend/dist.zip
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
|
||||
17
.gitignore
vendored
17
.gitignore
vendored
@@ -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
|
||||
|
||||
12
Dockerfile
12
Dockerfile
@@ -16,7 +16,8 @@ ENV S6_SERVICES_GRACETIME=30000 \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
COPY backend/requirements.txt .
|
||||
COPY backend/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 && \
|
||||
@@ -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" ]
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user