2022-09-09 09:12:17 +00:00
|
|
|
name: 'Publish the DMS Container Image'
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
cache-key:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-images:
|
|
|
|
name: 'Publish'
|
2023-01-28 12:53:17 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-09-09 09:12:17 +00:00
|
|
|
steps:
|
|
|
|
- name: 'Checkout'
|
2023-09-04 15:07:38 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-09-09 09:12:17 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: 'Prepare tags'
|
|
|
|
id: prep
|
2023-12-18 14:50:56 +00:00
|
|
|
uses: docker/metadata-action@v5.4.0
|
2022-09-09 09:12:17 +00:00
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ secrets.DOCKER_REPOSITORY }}
|
|
|
|
${{ secrets.GHCR_REPOSITORY }}
|
|
|
|
tags: |
|
|
|
|
type=edge,branch=master
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
|
|
|
|
|
|
|
- name: 'Set up QEMU'
|
2023-09-19 02:57:36 +00:00
|
|
|
uses: docker/setup-qemu-action@v3.0.0
|
2022-09-09 09:12:17 +00:00
|
|
|
with:
|
2022-12-23 01:56:36 +00:00
|
|
|
platforms: arm64
|
2022-09-09 09:12:17 +00:00
|
|
|
|
|
|
|
- name: 'Set up Docker Buildx'
|
2023-09-19 02:53:39 +00:00
|
|
|
uses: docker/setup-buildx-action@v3.0.0
|
2022-09-09 09:12:17 +00:00
|
|
|
|
|
|
|
# Try get the cached build layers from a prior `generic_build.yml` job.
|
|
|
|
# NOTE: Until adopting `type=gha` scoped cache exporter (in `docker/build-push-action`),
|
|
|
|
# only AMD64 image is expected to be cached, ARM images will build from scratch.
|
|
|
|
- name: 'Retrieve image build from build cache'
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: cache-buildx-${{ inputs.cache-key }}
|
|
|
|
restore-keys: |
|
|
|
|
cache-buildx-
|
|
|
|
|
|
|
|
- name: 'Login to DockerHub'
|
2023-09-19 03:01:59 +00:00
|
|
|
uses: docker/login-action@v3
|
2022-09-09 09:12:17 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: 'Login to GitHub Container Registry'
|
2023-09-19 03:01:59 +00:00
|
|
|
uses: docker/login-action@v3
|
2022-09-09 09:12:17 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: 'Build and publish images'
|
2023-11-20 13:03:32 +00:00
|
|
|
uses: docker/build-push-action@v5.1.0
|
2022-09-09 09:12:17 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
build-args: |
|
2023-11-29 21:21:26 +00:00
|
|
|
DMS_RELEASE=${{ github.ref_type == 'tag' && github.ref_name || 'edge' }}
|
2022-09-16 17:23:33 +00:00
|
|
|
VCS_REVISION=${{ github.sha }}
|
2022-12-23 01:56:36 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-09-09 09:12:17 +00:00
|
|
|
push: true
|
|
|
|
tags: ${{ steps.prep.outputs.tags }}
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2023-02-07 23:07:56 +00:00
|
|
|
# Disable provenance attestation: https://docs.docker.com/build/attestations/slsa-provenance/
|
|
|
|
provenance: false
|