Skip to content

Publish

Publish #1

Workflow file for this run

name: Publish
on:
release:
types:
- published
permissions:
contents: write
packages: write
env:
IMAGE_OWNER: ${{ github.repository_owner }}
IMAGE_TITLE: "cli"
IMAGE_DESCRIPTION: "the CLI for deployKF"
IMAGE_FOLDER: ""
IMAGE_PLATFORMS: |-
linux/amd64
linux/arm64
jobs:
build_and_push_images:
runs-on: ubuntu-latest
## only run if the tag looks like a semver
if: startsWith(github.ref_name, 'v')
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install QEMU
uses: docker/setup-qemu-action@v2
- name: Install Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Image Tags/Labels
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_TITLE }}
flavor: |
latest=auto
tags: |
type=semver,priority=200,pattern={{major}}.{{minor}}
type=semver,priority=100,pattern={{version}}
labels: |
org.opencontainers.image.title=${{ env.IMAGE_TITLE }}
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.url=https://github.com/${{ github.repository }}/tree/main/${{ env.IMAGE_FOLDER }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/main/${{ env.IMAGE_FOLDER }}
- name: Build and Push Image
uses: docker/build-push-action@v4
with:
context: ./${{ env.IMAGE_FOLDER }}
build-args: |
DKF_CLI_RELEASE_TAG=${{ github.ref_name }}
push: true
platforms: ${{ env.IMAGE_PLATFORMS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE_OWNER }}/ci/${{ env.IMAGE_TITLE }}
cache-to: type=registry,ref=ghcr.io/${{ env.IMAGE_OWNER }}/ci/${{ env.IMAGE_TITLE }},mode=max