Use GitHub Actions

This commit is contained in:
Joakim Hellsén 2025-07-24 23:56:51 +02:00
commit ec23af20a6

View file

@ -2,12 +2,8 @@ name: Build Docker Image
on: on:
push: push:
branches:
- master
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
schedule:
- cron: "@daily"
jobs: jobs:
docker: docker:
@ -17,38 +13,28 @@ jobs:
OPENAI_TOKEN: "0" OPENAI_TOKEN: "0"
steps: steps:
# GitHub Container Registry # GitHub Container Registry
- uses: https://github.com/docker/login-action@v3 - uses: docker/login-action@v3
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
with: with:
registry: ghcr.io registry: ghcr.io
username: thelovinator1 username: thelovinator1
password: ${{ secrets.PACKAGES_WRITE_GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# Gitea Container Registry
- uses: https://github.com/docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: git.lovinator.space
username: thelovinator
password: ${{ secrets.PACKAGES_WRITE_GITEA_TOKEN }}
# Download the latest commit from the master branch # Download the latest commit from the master branch
- uses: https://github.com/actions/checkout@v4 - uses: actions/checkout@v4
# Set up QEMU # Set up QEMU
- id: qemu - id: qemu
uses: https://github.com/docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
with: with:
image: tonistiigi/binfmt:master image: tonistiigi/binfmt:master
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
cache-image: false
# Set up Buildx so we can build multi-arch images # Set up Buildx so we can build multi-arch images
- uses: https://github.com/docker/setup-buildx-action@v3 - uses: docker/setup-buildx-action@v3
# Install the latest version of ruff # Install the latest version of ruff
- uses: https://github.com/astral-sh/ruff-action@v3 - uses: astral-sh/ruff-action@v3
with: with:
version: "latest" version: "latest"
@ -63,17 +49,15 @@ jobs:
# Extract metadata (tags, labels) from Git reference and GitHub events for Docker # Extract metadata (tags, labels) from Git reference and GitHub events for Docker
- id: meta - id: meta
uses: https://github.com/docker/metadata-action@v5 uses: docker/metadata-action@v5
env: env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with: with:
images: | images: ghcr.io/thelovinator1/anewdawn
ghcr.io/thelovinator1/anewdawn
git.lovinator.space/thelovinator/anewdawn
tags: type=raw,value=latest,enable=${{ gitea.ref == format('refs/heads/{0}', 'master') }} tags: type=raw,value=latest,enable=${{ gitea.ref == format('refs/heads/{0}', 'master') }}
# Build and push the Docker image # Build and push the Docker image
- uses: https://github.com/docker/build-push-action@v6 - uses: docker/build-push-action@v6
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64