feat: dev/prod environment split + APPLICATION_ID + privileged intents
- .env.dev / .env.prod with separate tokens and APPLICATION_ID - Bot syncs commands to specific guild in dev mode - Global sync for production - Updated .forgejo/workflows/ci.yml with SSH deploy to prod server - Updated .gitignore for .env.dev / .env.prod
This commit is contained in:
parent
e44349cea9
commit
0bdf414540
4 changed files with 54 additions and 14 deletions
|
|
@ -1,4 +1,4 @@
|
|||
name: CI
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -17,8 +17,7 @@ jobs:
|
|||
python-version: "3.12"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt -r requirements-dev.txt
|
||||
run: pip install -r requirements.txt -r requirements-dev.txt
|
||||
|
||||
- name: Ruff lint
|
||||
run: ruff check .
|
||||
|
|
@ -36,11 +35,39 @@ jobs:
|
|||
python-version: "3.12"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt -r requirements-dev.txt
|
||||
run: pip install -r requirements.txt -r requirements-dev.txt
|
||||
|
||||
- name: Syntax check
|
||||
run: python -m py_compile bot.py && python -m py_compile vision.py && python -m py_compile config.py
|
||||
run: |
|
||||
python -m py_compile bot.py
|
||||
python -m py_compile vision.py
|
||||
python -m py_compile config.py
|
||||
|
||||
- name: Run tests
|
||||
run: pytest tests/ -v || true
|
||||
|
||||
deploy:
|
||||
needs: [lint, test]
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy to production server
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ secrets.PROD_HOST }}
|
||||
username: ${{ secrets.PROD_USER }}
|
||||
password: ${{ secrets.PROD_PASSWORD }}
|
||||
script: |
|
||||
cd /home/discord/Bots/VisionApp
|
||||
git pull origin main --rebase
|
||||
if command -v docker &>/dev/null; then
|
||||
docker compose build --no-cache vision
|
||||
docker compose up -d vision
|
||||
else
|
||||
pkill -f "python.*vision\.py" 2>/dev/null || true
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
nohup python vision.py > /dev/null 2>&1 &
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue