81 lines
2.4 KiB
YAML
81 lines
2.4 KiB
YAML
---
|
|
name: Test code, build Docker image, and push to Docker Hub and GitHub Container Registry.
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 6 * * *"
|
|
|
|
env:
|
|
SERVE_DOMAIN: https://localhost/
|
|
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
|
UPLOAD_FOLDER: ./Uploads
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: FedericoCarboni/setup-ffmpeg@v3
|
|
id: setup-ffmpeg
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.13
|
|
- uses: astral-sh/setup-uv@v5
|
|
with:
|
|
version: "latest"
|
|
- run: uv sync --all-extras --all-groups
|
|
- run: uv run pytest
|
|
ruff:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: astral-sh/ruff-action@v3
|
|
with:
|
|
version: "latest"
|
|
- run: ruff check --exit-non-zero-on-fix --verbose
|
|
- run: ruff format --check --verbose
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
if: github.event_name != 'pull_request'
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
needs: [test, ruff]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-qemu-action@v3
|
|
with:
|
|
platforms: all
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Login to Docker Hub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Login to GitHub Container Registry
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build and push Docker image
|
|
id: build-and-push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64, linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: |
|
|
ghcr.io/thelovinator1/discord-embed:latest
|
|
ghcr.io/thelovinator1/discord-embed:master
|
|
thelovinator/discord-nice-embed-maker-for-my-yoy:latest
|
|
thelovinator/discord-nice-embed-maker-for-my-yoy:master
|