Repository navigation
124 lines (110 loc) · 3.63 KB
/
Copy pathbuild.yaml
File metadata and controls
124 lines (110 loc) · 3.63 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Build Stub
on:
push:
tags:
- "v[0-9]+.*"
workflow_dispatch:
inputs:
latest:
description: "Tag the image as latest"
required: false
type: boolean
default: false
tag:
description: "Tag to build (defaults to current commit)"
required: false
type: string
jobs:
build:
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v4
id: buildx
- uses: taiki-e/install-action@just
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tag
id: tag
run: |
if [[ -n "${{ inputs.tag }}" ]]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=$(git describe --tag --always --dirty --match v[0-9]* 2>/dev/null || echo dev)" >> "$GITHUB_OUTPUT"
fi
- name: Build stub (${{ matrix.arch }})
run: |
CONTAINER_RUNTIME=docker \
ARCH=${{ matrix.arch }} \
PUSH=true \
TAG=ci-${{ matrix.arch }} \
just oci
manifest:
name: Combine multi-arch manifest
needs: build
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
env:
CONTAINER_RUNTIME: docker
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: taiki-e/install-action@just
- name: Determine tag
id: tag
run: |
if [[ -n "${{ inputs.tag }}" ]]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=$(git describe --tag --always --dirty --match v[0-9]* 2>/dev/null || echo dev)" >> "$GITHUB_OUTPUT"
fi
- name: Create multi-arch manifest (${{ steps.tag.outputs.tag }})
env:
TAG: ${{ steps.tag.outputs.tag }}
LATEST: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.latest) }}
KOCI_REGISTRY_USERNAME: ${{ github.actor }}
KOCI_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
just merge amd64=ci-amd64 arm64=ci-arm64
- name: Annotate image sizes (${{ steps.tag.outputs.tag }})
env:
TAG: ${{ steps.tag.outputs.tag }}
KOCI_REGISTRY_USERNAME: ${{ github.actor }}
KOCI_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
just annotate
- name: Annotate image sizes (latest)
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.latest) }}
env:
TAG: latest
KOCI_REGISTRY_USERNAME: ${{ github.actor }}
KOCI_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
just annotate
- name: Build summary
run: |
echo "### Multi-arch manifest created" >> "$GITHUB_STEP_SUMMARY"
echo "- **Tag:** \`stub:${{ steps.tag.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
if [[ "${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.latest) }}" == "true" ]]; then
echo "- **Latest:** \`stub:latest\`" >> "$GITHUB_STEP_SUMMARY"
fi