Skip to content

Build and Release Web version web #35

Build and Release Web version web

Build and Release Web version web #35

run-name: "Build and Release Web version ${{ github.ref_name }}"
on:
push:
branches:
- web
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/dk10ws/slcm
jobs:
build:
name: Build ${{ matrix.service }} (${{ matrix.arch }})
strategy:
matrix:
arch: [amd64, arm64]
service: [frontend, backend]
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5
with:
ref: "web"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push ${{ matrix.service }} Docker Image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.service }}
push: true
platforms: linux/${{ matrix.arch }}
tags: |
${{ env.IMAGE_PREFIX }}-${{ matrix.service }}:latest-${{ matrix.arch }}
${{ env.IMAGE_PREFIX }}-${{ matrix.service }}:${{ github.sha }}-${{ matrix.arch }}
cache-from: type=gha,scope=${{ matrix.service }}-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.service }}-${{ matrix.arch }}
merge-manifest:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
service: [frontend, backend]
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create multi-arch manifest for ${{ matrix.service }}
run: |
docker buildx imagetools create \
-t ${{ env.IMAGE_PREFIX }}-${{ matrix.service }}:${{ github.sha }} \
-t ${{ env.IMAGE_PREFIX }}-${{ matrix.service }}:latest \
${{ env.IMAGE_PREFIX }}-${{ matrix.service }}:${{ github.sha }}-amd64 \
${{ env.IMAGE_PREFIX }}-${{ matrix.service }}:${{ github.sha }}-arm64