Publish Docker image #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
workflow_dispatch: | |
inputs: | |
dockerTag: | |
description: 'Docker tag' | |
required: true | |
type: string | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
cache: 'sbt' | |
- run: sbt --mem 4096 --batch buildTarballsForDocker | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
flavor: latest=false | |
tags: type=raw,value=${{ inputs.dockerTag }} | |
labels: | | |
org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
org.opencontainers.image.licenses=MIT | |
org.opencontainers.image.description="Unit Zero Node" | |
- uses: docker/build-push-action@v5 | |
id: push | |
with: | |
context: ./docker | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
pull: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |