-
Notifications
You must be signed in to change notification settings - Fork 108
71 lines (63 loc) · 2.49 KB
/
Copy pathcontext-engine-images.yml
File metadata and controls
71 lines (63 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Context Engine Images
# Builds and pushes the optional context-engine Docker images (server+worker and
# the one-shot migrate) as multi-arch images to GHCR. Rides the same "Publish"
# event as the app so they're versioned together. The future app-managed engine
# (Phase 6) pulls these by the release tag.
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version tag to publish (e.g. 0.1.0)."
required: false
permissions:
contents: read
packages: write
jobs:
build-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# server + worker: built from the repo root (needs the root go.mod).
- name: context-engine
context: .
dockerfile: services/context-engine/Dockerfile
# one-shot Atlas migrations: built from the service dir.
- name: context-engine-migrate
context: services/context-engine
dockerfile: services/context-engine/Dockerfile.migrate
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/${{ matrix.name }}
tags: |
type=semver,pattern=v{{version}}
type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
type=sha,format=short
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
# Push on a real release, or on a manual dispatch only when a version is
# given. A bare workflow_dispatch is a build-only dry run (nothing pushed).
push: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max