owpengram-server/.github/workflows/container-images.yml
2026-09-01 12:06:31 +03:00

76 lines
2.1 KiB
YAML

name: Publish main container images (manual)
on:
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: containers-main-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
name: Publish ${{ matrix.role }}
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- role: server
target: server-test
- role: admin
target: admin
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Log in to GHCR
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate image metadata
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ghcr.io/${{ github.repository }}/${{ matrix.role }}
tags: |
type=raw,value=main
type=sha,prefix=sha-
- name: Set build date
id: build
shell: bash
run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
- name: Build and publish
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: Dockerfile
target: ${{ matrix.target }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VCS_REF=${{ github.sha }}
VCS_BRANCH=${{ github.ref_name }}
VCS_TREE_STATE=clean
BUILD_DATE=${{ steps.build.outputs.date }}
cache-from: type=gha,scope=main-${{ matrix.role }}
cache-to: type=gha,mode=max,scope=main-${{ matrix.role }}