feat: 更新工作流配置,添加可选分支输入参数并调整缓存引用

pull/1419/head
infinitycat 2025-12-08 15:04:47 +08:00
parent 00d438a086
commit 268eafe3ee
No known key found for this signature in database
GPG Key ID: 8557D2947688521D
3 changed files with 20 additions and 10 deletions

View File

@ -3,10 +3,15 @@ name: Docker Build and Push (Dev)
on: on:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
push: # push:
branches: # branches:
- dev # - dev
workflow_dispatch: # 允许手动触发工作流 workflow_dispatch: # 允许手动触发工作流
inputs:
branch:
description: 'Branch to build'
required: false
default: 'dev'
# Workflow's jobs # Workflow's jobs
jobs: jobs:
@ -57,8 +62,8 @@ jobs:
platforms: linux/amd64 platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile file: ./Dockerfile
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:dev-amd64-buildcache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache,mode=max cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:dev-amd64-buildcache,mode=max
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/maibot,push-by-digest=true,name-canonical=true,push=true outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/maibot,push-by-digest=true,name-canonical=true,push=true
build-args: | build-args: |
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
@ -111,8 +116,8 @@ jobs:
platforms: linux/arm64/v8 platforms: linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile file: ./Dockerfile
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:arm64-buildcache cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:dev-arm64-buildcache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:arm64-buildcache,mode=max cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:dev-arm64-buildcache,mode=max
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/maibot,push-by-digest=true,name-canonical=true,push=true outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/maibot,push-by-digest=true,name-canonical=true,push=true
build-args: | build-args: |
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')

View File

@ -11,6 +11,11 @@ on:
- "*.*.*" - "*.*.*"
- "*.*.*-*" - "*.*.*-*"
workflow_dispatch: # 允许手动触发工作流 workflow_dispatch: # 允许手动触发工作流
inputs:
branch:
description: 'Branch to build'
required: false
default: 'main'
# Workflow's jobs # Workflow's jobs
jobs: jobs:

View File

@ -40,7 +40,7 @@ services:
- ./data/MaiMBot:/MaiMBot/data # 共享目录 - ./data/MaiMBot:/MaiMBot/data # 共享目录
- ./data/MaiMBot/plugins:/MaiMBot/plugins # 插件目录 - ./data/MaiMBot/plugins:/MaiMBot/plugins # 插件目录
- ./data/MaiMBot/logs:/MaiMBot/logs # 日志目录 - ./data/MaiMBot/logs:/MaiMBot/logs # 日志目录
- site-packages:/usr/local/lib/python3.13/site-packages # 持久化Python包 # - site-packages:/usr/local/lib/python3.13/site-packages # 持久化Python包,需要时启用
restart: always restart: always
networks: networks:
- maim_bot - maim_bot
@ -87,8 +87,8 @@ services:
# networks: # networks:
# - maim_bot # - maim_bot
volumes: # volumes: # 若需要持久化Python包时启用
site-packages: # site-packages:
networks: networks:
maim_bot: maim_bot:
driver: bridge driver: bridge