Compare commits
6 Commits
copilot/ad
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c628443c8 | |||
| bbedb98ce0 | |||
| 3b12eb5e21 | |||
| 747458d7f3 | |||
| fe8ab74bd3 | |||
| 354ea793c0 |
137
.github/workflows/main.yml
vendored
137
.github/workflows/main.yml
vendored
@@ -1,122 +1,37 @@
|
|||||||
name: Build ChatGPT-Discord-Bot
|
name: Build & Push Docker to Gitea Registry
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: git.quocanh.me
|
||||||
|
OWNER: coder-vippro
|
||||||
|
IMAGE: chatgpt-discord-bot
|
||||||
|
TAG: latest
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest # khuyên dùng runner của bạn
|
||||||
env:
|
|
||||||
MONGODB_URI: ${{ secrets.MONGODB_URI }}
|
|
||||||
environment: Private Server Deploy
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Login to Gitea registry
|
||||||
uses: actions/setup-python@v5.3.0
|
|
||||||
with:
|
|
||||||
python-version: '3.13.2'
|
|
||||||
cache: 'pip'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
echo "${{ secrets.REGISTRY_PASSWORD }}" \
|
||||||
pip install pytest pytest-cov flake8
|
| docker login "$REGISTRY" \
|
||||||
pip install -r requirements.txt
|
-u "${{ secrets.REGISTRY_USERNAME }}" \
|
||||||
|
--password-stdin
|
||||||
|
|
||||||
- name: Run unit tests with coverage
|
- name: Setup buildx
|
||||||
run: |
|
|
||||||
python -m pytest tests/ --cov=src
|
|
||||||
|
|
||||||
- name: Check dependencies for security issues
|
|
||||||
uses: pyupio/safety-action@v1.0.1
|
|
||||||
with:
|
|
||||||
api-key: ${{ secrets.SAFETY_API_KEY }}
|
|
||||||
|
|
||||||
build-amd64:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: Private Server Deploy
|
|
||||||
needs: tests
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Build & push
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image for amd64
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
tags: ghcr.io/coder-vippro/chatgpt-discord-bot:latest-amd64
|
|
||||||
|
|
||||||
build-arm64:
|
|
||||||
runs-on: ubuntu-24.04-arm
|
|
||||||
environment: Private Server Deploy
|
|
||||||
needs: tests
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image for arm64
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
platforms: linux/arm64
|
|
||||||
tags: ghcr.io/coder-vippro/chatgpt-discord-bot:latest-arm64
|
|
||||||
|
|
||||||
merge-manifest:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-amd64, build-arm64]
|
|
||||||
steps:
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create and push multi-arch manifest
|
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create -t ghcr.io/coder-vippro/chatgpt-discord-bot:latest \
|
docker buildx build \
|
||||||
ghcr.io/coder-vippro/chatgpt-discord-bot:latest-amd64 \
|
--platform linux/amd64,linux/arm64 \
|
||||||
ghcr.io/coder-vippro/chatgpt-discord-bot:latest-arm64
|
-t $REGISTRY/$OWNER/$IMAGE:$TAG \
|
||||||
|
--push \
|
||||||
deploy-notification:
|
.
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: merge-manifest
|
|
||||||
if: ${{ success() }}
|
|
||||||
steps:
|
|
||||||
- name: Send deployment notification
|
|
||||||
uses: sarisia/actions-status-discord@v1
|
|
||||||
with:
|
|
||||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
|
||||||
title: "✅ New deployment successful!"
|
|
||||||
description: |
|
|
||||||
Image: ${{ needs.build-and-push.outputs.image }}:${{ needs.build-and-push.outputs.version }}
|
|
||||||
Commit: ${{ github.sha }}
|
|
||||||
Repository: ${{ github.repository }}
|
|
||||||
color: 0x00ff00
|
|
||||||
username: GitHub Actions
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ dnspython>=2.5.0
|
|||||||
|
|
||||||
# Web & HTTP
|
# Web & HTTP
|
||||||
aiohttp>=3.9.0
|
aiohttp>=3.9.0
|
||||||
requests>=2.31.0
|
requests>=2.32.5
|
||||||
beautifulsoup4>=4.12.0
|
beautifulsoup4>=4.12.0
|
||||||
|
|
||||||
# AI & ML
|
# AI & ML
|
||||||
runware>=0.4.33
|
runware>=0.4.33
|
||||||
tiktoken>=0.7.0
|
tiktoken>=0.12.0
|
||||||
|
|
||||||
# Data Processing
|
# Data Processing
|
||||||
pandas>=2.1.0
|
pandas>=2.1.0
|
||||||
@@ -46,4 +46,4 @@ ruff>=0.3.0
|
|||||||
|
|
||||||
# Monitoring & Logging (Optional)
|
# Monitoring & Logging (Optional)
|
||||||
# sentry-sdk>=1.40.0 # Uncomment for error monitoring
|
# sentry-sdk>=1.40.0 # Uncomment for error monitoring
|
||||||
# python-json-logger>=2.0.0 # Uncomment for structured logging
|
# python-json-logger>=2.0.0 # Uncomment for structured logging
|
||||||
|
|||||||
Reference in New Issue
Block a user