This repository was archived by the owner on Aug 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +92
-39
lines changed
Expand file tree Collapse file tree 6 files changed +92
-39
lines changed Original file line number Diff line number Diff line change 1- name : Build and Push Docker image
1+ name : flow
22
33on :
44 push :
5- branches :
6- # - main
7- - qeithjqeiothioqehbtjkqehjkle
85
9- jobs :
10- build :
11- runs-on : ubuntu-latest
12-
13- steps :
14- - name : Checkout code
15- uses : actions/checkout@v3
6+ concurrency :
7+ group : ${{ github.ref }}
8+ cancel-in-progress : true
169
17- - name : Log in to GitHub Packages
18- uses : docker/login-action@v2
19- with :
20- registry : ghcr.io
21- username : ${{ github.actor }}
22- password : ${{ secrets.GITHUB_TOKEN }}
23-
24- - name : Set up Docker Buildx
25- uses : docker/setup-buildx-action@v2
10+ jobs :
11+ publish :
12+ uses : ./.github/workflows/template-publish.yml
2613
27- - name : Build and push Docker image
28- uses : docker/build-push-action@v3
29- with :
30- context : .
31- file : Dockerfile
32- push : true
33- tags : ghcr.io/${{ github.repository }}/asyncbot:latest
14+ deploy :
15+ needs : [publish]
16+ uses : ./.github/workflows/template-deploy.yml
Original file line number Diff line number Diff line change 1+ name : deploy
2+
3+ on :
4+ workflow_call :
5+
6+ jobs :
7+ deploy :
8+ runs-on : [self-hosted, async-bot]
9+
10+ steps :
11+ - name : Checkout
12+ uses : actions/checkout@v4
13+
14+ - name : Login Docker
15+ uses : docker/login-action@v3
16+ with :
17+ registry : ghcr.io
18+ username : ${{ github.actor }}
19+ password : ${{ github.token }}
20+
21+ - name : Deploy
22+ run : |
23+ export COMPOSE_PROJECT_NAME=async-bot
24+ docker compose pull
25+ docker compose up -d
Original file line number Diff line number Diff line change 1+ name : publish
2+
3+ on :
4+ workflow_call :
5+
6+ jobs :
7+ publish :
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - name : Checkout
12+ uses : actions/checkout@v4
13+
14+ - name : Log in to GitHub Packages
15+ uses : docker/login-action@v2
16+ with :
17+ registry : ghcr.io
18+ username : ${{ github.actor }}
19+ password : ${{ secrets.GITHUB_TOKEN }}
20+
21+ - name : Set up Docker Buildx
22+ uses : docker/setup-buildx-action@v2
23+
24+ - name : Build and push Docker image
25+ uses : docker/build-push-action@v3
26+ with :
27+ context : .
28+ file : Dockerfile
29+ push : true
30+ tags : ghcr.io/${{ github.repository }}/async-bot:latest
Original file line number Diff line number Diff line change 1- FROM ubuntu:latest
1+ FROM python:3.13-alpine AS builder
2+
3+ RUN apk add build-base patchelf ccache
4+ RUN pip install poetry nuitka zstandard
5+
6+ WORKDIR /app
7+
8+ COPY pyproject.toml poetry.lock ./
9+
10+ RUN poetry config virtualenvs.in-project true && \
11+ poetry config virtualenvs.create true && \
12+ poetry config virtualenvs.path .venv && \
13+ poetry install
14+
15+ FROM python:3.13-alpine AS final
16+
17+ WORKDIR /app
18+
19+ COPY --from=builder /app/.venv ./.venv
20+
21+ COPY ./src ./src
22+ COPY ./pyproject.toml ./pyproject.toml
23+
24+ CMD ["/bin/sh" , "-c" , "source .venv/bin/activate && nb run" ]
225
3- RUN apt-get update && apt-get install -y git
Original file line number Diff line number Diff line change 1- [project ]
2- name = " AsyncBot"
3- version = " 0.1.0"
4- description = " AsyncBot"
5- readme = " README.md"
6- requires-python = " >=3.9, <4.0"
7-
8-
91[tool .nonebot ]
102adapters = [
113 { name = " OneBot V11" , module_name = " nonebot.adapters.onebot.v11" },
@@ -20,6 +12,7 @@ version = "0.0.0"
2012description = " AsyncBot"
2113authors = [" dsx137" ]
2214license = " AGPLv3"
15+ package-mode = false
2316
2417[tool .poetry .dependencies ]
2518python = " >=3.9, <4.0"
Original file line number Diff line number Diff line change 1- from pydantic import BaseModel , field_validator
1+ from pydantic import BaseModel , field_validator , Field
22from nonebot import get_plugin_config
33
44
55class Config (BaseModel ):
6- api_key : str
6+ api_key : str = Field (..., alias = "API_KEY" )
77
88
99plugin_config = get_plugin_config (Config )
You can’t perform that action at this time.
0 commit comments