Skip to content

Build and Publish Image #189

Build and Publish Image

Build and Publish Image #189

name: Build and Publish Image
on:
workflow_run:
workflows: ["Semantic Release"]
types:
- completed
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v7
with:
fetch-tags: true
- name: Set up qemu
uses: docker/setup-qemu-action@v4
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v4
- name: registry auth
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: extract version
run: |
echo "VERSION=$(grep __version__ templatron/__init__.py | cut -f 2 -d = | tr -d ' ' | tr -d \")" >> "$GITHUB_ENV"
- name: image metadata
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302
with:
flavor: |
latest=true
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,enable=true,value=${{ env.VERSION }}
- name: build & push image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a
with:
build-args: UPSTREAM_VERSION=${{ env.UPSTREAM_VERSION }}
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}