Repository navigation
70 lines (61 loc) · 2.39 KB
/
Copy pathimage.yml
File metadata and controls
70 lines (61 loc) · 2.39 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
# Builds the server image (server binary + a pinned web player baked in at
# /app/web) and pushes it to ghcr.io/<owner>/audiosilo-server. Publish the web
# image first (audiosilo-frontend → ghcr.io/<owner>/audiosilo-web), since this
# build pulls it via COPY --from.
name: server image
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
web_version:
description: web player image tag to bake in
default: latest
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
# GHCR image references must be lowercase; the owner login can be mixed-case.
- name: Resolve owner (lowercase)
id: owner
run: echo "lc=${OWNER,,}" >> "$GITHUB_OUTPUT"
env:
OWNER: ${{ github.repository_owner }}
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Image metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ steps.owner.outputs.lc }}/audiosilo-server
flavor: latest=false
tags: |
type=semver,pattern={{version}}
type=sha
# Only a real release (a v* tag) may move the public :latest - a
# workflow_dispatch from a feature branch must not republish it.
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: |
WEB_IMAGE=ghcr.io/${{ steps.owner.outputs.lc }}/audiosilo-web:${{ github.event.inputs.web_version || 'latest' }}
# On a tag build stamp the semver version; on dispatch (no semver tag) the
# metadata version would resolve to "latest", so fall back to a dev-<sha>
# marker rather than reporting the binary version as "latest".
VERSION=${{ startsWith(github.ref, 'refs/tags/') && steps.meta.outputs.version || format('dev-{0}', github.sha) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}