-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (58 loc) · 1.91 KB
/
Copy pathdocker-publish.yml
File metadata and controls
67 lines (58 loc) · 1.91 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
name: Publish image (main)
# Rolling dev image for the main branch (:main and :sha-<commit>), for self-hosters
# tracking the tip. Versioned tags (:X.Y.Z, :X.Y, :latest) and npm are owned by
# release.yml — this workflow deliberately does not trigger on tags.
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: docker-main-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
if: github.repository == 'lukaisailovic/openislands'
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/ghcr-buildx
- name: Extract image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# :main on a branch push, :sha-<commit> on every run.
tags: |
type=ref,event=branch
type=sha
- name: Build and push
id: push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Attestation lands in GitHub's native store (verify with `gh attestation
# verify oci://...`). Not pushed to the registry — that fallback creates a
# `sha256-<digest>` referrer tag that clutters the tag list.
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}