Move from github to gitea (#1)
Publish Docker Image / test (push) Successful in 43s
Publish Docker Image / build-and-push (push) Successful in 4m15s

Reviewed-on: #1
Co-authored-by: Esteban Vincent <este.vincent@gmail.com>
Co-committed-by: Esteban Vincent <este.vincent@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
2026-05-31 01:13:19 +02:00
committed by EstebanVincent
parent e466290560
commit fec24d811d
2 changed files with 27 additions and 24 deletions
+23 -22
View File
@@ -5,35 +5,35 @@ on:
branches: [main] branches: [main]
env: env:
REGISTRY: ghcr.io REGISTRY: gitea.nasvincent.com
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip apt-get update && apt-get install -y python3-pip
pip install -r src/requirements.txt python3 -m pip install --upgrade pip --break-system-packages
pip3 install -r src/requirements.txt --break-system-packages
- name: Lint and format with Ruff - name: Lint and format with Ruff
run: | run: |
pip install ruff pip3 install ruff --break-system-packages
ruff check src ruff check src
ruff format --check src ruff format --check src
build-and-push: build-and-push:
needs: test needs: test
environment: DEV runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
packages: write packages: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Docker
run: |
apt-get update && apt-get install -y docker.io
- name: Lowercase repository name - name: Lowercase repository name
run: echo "IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/discord-bot" >> $GITHUB_ENV run: echo "IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/discord-bot" >> $GITHUB_ENV
- name: Calculate new version - name: Calculate new version
@@ -47,8 +47,8 @@ jobs:
- uses: docker/login-action@v3 - uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ secrets.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.TOKEN }}
- uses: docker/build-push-action@v5 - uses: docker/build-push-action@v5
with: with:
context: . context: .
@@ -57,17 +57,18 @@ jobs:
tags: | tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha labels: |
cache-to: type=gha,mode=max org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
- name: Create Git tag - name: Create Git tag
run: | run: |
git config user.email "action@github.com" git config user.email "action@gitea.nasvincent.com"
git config user.name "GitHub Action" git config user.name "Gitea Action"
git tag ${{ steps.version.outputs.new_version }} git tag ${{ steps.version.outputs.new_version }} && git push origin ${{ steps.version.outputs.new_version }} || echo "Tag already exists, skipping"
git push origin ${{ steps.version.outputs.new_version }}
- name: Save new minor version - name: Save new minor version
env:
GH_TOKEN: ${{ secrets.PAT_ADMIN_TOKEN }}
GH_REPO: ${{ github.repository }}
run: | run: |
gh variable set VERSION_MINOR --body "${{ steps.version.outputs.new_minor }}" --env DEV curl -f -X PUT "https://gitea.nasvincent.com/api/v1/repos/${{ github.repository }}/actions/variables/VERSION_MINOR" \
-H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"value\": \"${{ steps.version.outputs.new_minor }}\"}"
+3 -1
View File
@@ -8,10 +8,12 @@ A Discord bot with slash commands for meme generation and more.
- [uv](https://docs.astral.sh/uv/) - Fast Python package manager - [uv](https://docs.astral.sh/uv/) - Fast Python package manager
- Discord Bot Token - Discord Bot Token
- n8n Webhook URL and API Key - n8n Webhook URL and API Key
π
## Setup ## Setup
### Local Development ### Local Development
```bash ```bash
git clone https://github.com/EstebanVincent/DiscordBot.git git clone https://github.com/EstebanVincent/DiscordBot.git
cd DiscordBot cd DiscordBot
@@ -21,6 +23,7 @@ uv run python src/main.py
``` ```
### Docker ### Docker
```bash ```bash
# Build and run locally # Build and run locally
docker build -t discord-bot . docker build -t discord-bot .
@@ -41,7 +44,6 @@ docker run -d --name discord-bot -e DISCORD_TOKEN=... -e WEBHOOK_URL=... -e API_
2. Copy bot token to environment variables 2. Copy bot token to environment variables
3. Invite bot with permissions: Send Messages, Use Slash Commands, Embed Links 3. Invite bot with permissions: Send Messages, Use Slash Commands, Embed Links
## Development ## Development
```bash ```bash