Publish branch main to tag latest #46
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 | |
run-name: Publish branch ${{ github.ref_name }} to tag ${{ inputs.dockerTag }} | |
on: | |
workflow_dispatch: | |
inputs: | |
dockerTag: | |
description: 'Docker tag' | |
required: true | |
baseImage: | |
description: 'Base image' | |
required: true | |
default: 'wavesplatform/wavesnode:1.5.9' | |
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' | |
- uses: sbt/setup-sbt@v1 | |
- 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=sha | |
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 | |
build-args: baseImage=${{ inputs.baseImage }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |