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:
|
||||
push:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: git.quocanh.me
|
||||
OWNER: coder-vippro
|
||||
IMAGE: chatgpt-discord-bot
|
||||
TAG: latest
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MONGODB_URI: ${{ secrets.MONGODB_URI }}
|
||||
environment: Private Server Deploy
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest # khuyên dùng runner của bạn
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.3.0
|
||||
with:
|
||||
python-version: '3.13.2'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Login to Gitea registry
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest pytest-cov flake8
|
||||
pip install -r requirements.txt
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" \
|
||||
| docker login "$REGISTRY" \
|
||||
-u "${{ secrets.REGISTRY_USERNAME }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Run unit tests with coverage
|
||||
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
|
||||
- name: Setup 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 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
|
||||
- name: Build & push
|
||||
run: |
|
||||
docker buildx imagetools create -t ghcr.io/coder-vippro/chatgpt-discord-bot:latest \
|
||||
ghcr.io/coder-vippro/chatgpt-discord-bot:latest-amd64 \
|
||||
ghcr.io/coder-vippro/chatgpt-discord-bot:latest-arm64
|
||||
|
||||
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
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-t $REGISTRY/$OWNER/$IMAGE:$TAG \
|
||||
--push \
|
||||
.
|
||||
|
||||
@@ -10,12 +10,12 @@ dnspython>=2.5.0
|
||||
|
||||
# Web & HTTP
|
||||
aiohttp>=3.9.0
|
||||
requests>=2.31.0
|
||||
requests>=2.32.5
|
||||
beautifulsoup4>=4.12.0
|
||||
|
||||
# AI & ML
|
||||
runware>=0.4.33
|
||||
tiktoken>=0.7.0
|
||||
tiktoken>=0.12.0
|
||||
|
||||
# Data Processing
|
||||
pandas>=2.1.0
|
||||
|
||||
Reference in New Issue
Block a user