Skip to content

Build and push image #30

Build and push image

Build and push image #30

Workflow file for this run

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 }}