-
Notifications
You must be signed in to change notification settings - Fork 1.1k
84 lines (80 loc) · 2.43 KB
/
push-image.yml
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
name: Build and push image
on:
release:
types: [published]
workflow_dispatch:
inputs:
runtime:
description: 'Runtime image'
required: true
default: 'hackmdio/runtime:16.20.2-35fe7e39'
buildpack:
description: 'Buildpack image'
required: true
default: 'hackmdio/buildpack:16.20.2-35fe7e39'
registry_image:
description: 'image name'
required: true
default: 'hackmdio/hackmd'
jobs:
build-amd64:
uses: ./.github/workflows/build-steps.yml
secrets: inherit
with:
platform: linux/amd64
platform_pair: linux_amd64
registry_image: ${{ github.event.inputs.registry_image }}
runtime: ${{ github.event.inputs.runtime }}
buildpack: ${{ github.event.inputs.buildpack }}
runs_on: ubuntu-latest
build-arm64:
uses: ./.github/workflows/build-steps.yml
secrets: inherit
with:
platform: linux/arm64
platform_pair: linux_arm64
registry_image: ${{ github.event.inputs.registry_image }}
runtime: ${{ github.event.inputs.runtime }}
buildpack: ${{ github.event.inputs.buildpack }}
runs_on: macos-latest
merge:
runs-on: ubuntu-latest
needs:
- build-amd64
- build-arm64
steps:
-
name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.event.inputs.registry_image }}
tags: |
type=match,pattern=\d.\d.\d
type=sha,prefix=
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ github.event.inputs.registry_image }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ github.event.inputs.registry_image }}:${{ steps.meta.outputs.version }}