Files
ds2api/.gitea/workflows/build-image.yml
T
omar b023edc063
Build and Publish Image / build (push) Failing after 6m20s
ci: add Gitea Actions workflow to build and publish multi-arch image
Builds linux/amd64+arm64 from source and pushes to the built-in Gitea
container registry (git.qomar.pw/omar/ds2api) on push to main and tags.
Adds --platform=$BUILDPLATFORM to the node/go builder stages so arm64
cross-compiles on the amd64 runner instead of slow QEMU emulation.
2026-06-02 21:38:12 +03:00

68 lines
2.0 KiB
YAML

name: Build and Publish Image
# Собирает Docker-образ из исходника и пушит в встроенный registry Gitea (Packages).
# Образ: git.qomar.pw/omar/ds2api
# Триггеры: push в main, любой тег vX.Y.Z, и ручной запуск.
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
env:
REGISTRY: git.qomar.pw
# github.repository в Gitea = "omar/ds2api" (уже в нижнем регистре)
IMAGE: git.qomar.pw/${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
# actor — пользователь, запустивший workflow (omar); GITEA_TOKEN выдаётся автоматически
username: ${{ github.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: "false"
DOCKER_BUILD_SUMMARY: "false"
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_VERSION=${{ github.ref_name }}