Refactor Docker publish workflow
This commit is contained in:
@ -2,34 +2,66 @@ name: Build Docker Image
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "@daily"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
enabled: true
|
||||||
|
dir: ""
|
||||||
|
host: "192.168.1.127"
|
||||||
|
port: 8088
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
env:
|
env:
|
||||||
DISCORD_TOKEN: "0"
|
DISCORD_TOKEN: "0"
|
||||||
OPENAI_TOKEN: "0"
|
OPENAI_TOKEN: "0"
|
||||||
if: github.event_name != 'pull_request'
|
if: gitea.event_name != 'pull_request'
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: https://github.com/actions/checkout@v4
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: https://github.com/docker/setup-qemu-action@v3
|
||||||
- uses: docker/login-action@v3
|
- uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
- uses: https://github.com/astral-sh/ruff-action@v3
|
||||||
|
|
||||||
|
- run: docker build --check .
|
||||||
|
- run: ruff check --exit-non-zero-on-fix --verbose
|
||||||
|
- run: ruff format --check --verbose
|
||||||
|
|
||||||
|
- id: meta
|
||||||
|
uses: https://github.com/docker/metadata-action@v5
|
||||||
|
env:
|
||||||
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/thelovinator1/anewdawn
|
||||||
|
git.lovinator.space/thelovinator/anewdawn
|
||||||
|
tags: type=raw,value=latest,enable=${{ gitea.ref == format('refs/heads/{0}', 'master') }}
|
||||||
|
|
||||||
|
# GitHub Container Registry
|
||||||
|
- uses: https://github.com/docker/login-action@v3
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: thelovinator1
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.PACKAGES_WRITE_GITHUB_TOKEN }}
|
||||||
- uses: docker/build-push-action@v6
|
|
||||||
|
# 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.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
- uses: https://github.com/docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ gitea.event_name != 'pull_request' }}
|
||||||
tags: |
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
ghcr.io/thelovinator1/anewdawn:latest
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
annotations: ${{ steps.meta.outputs.annotations }}
|
||||||
|
Reference in New Issue
Block a user