Files
PreMiD/.github/workflows/cd.yaml
Bas van Zanten 7d93ee3a7d feat: add missing files (#1101)
* feat: add missing files

* chore: update readme

* chore: update branch

* chore: remove olds from matrix

* chore: remove dev containers
2025-12-11 11:07:38 +01:00

66 lines
1.9 KiB
YAML

name: CD
on:
push:
branches:
- main
tags:
- "*"
permissions:
packages: write
jobs:
build:
name: Build Docker Images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- pd
- schema-server
steps:
- name: Checkout Repository
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: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push website
uses: docker/build-push-action@v6
if: matrix.target == 'website'
with:
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: SERVICE=${{ matrix.target }}
target: website
tags: ghcr.io/premid/${{ matrix.target }}:beta-${{ github.sha }}-${{ github.run_number }}
- name: Get package.json version
if: matrix.target != 'website'
id: get_version
run: echo ::set-output name=version::$(node -p "require('./apps/${{ matrix.target }}/package.json').version")
shell: bash
- name: Build and push other images
uses: docker/build-push-action@v6
if: matrix.target != 'website' && startsWith(github.ref, 'refs/tags/')
with:
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
target: prod
build-args: SERVICE=${{ matrix.target }}
tags: ghcr.io/premid/${{ matrix.target }}:latest,ghcr.io/premid/${{ matrix.target }}:${{ steps.get_version.outputs.version }}