Skip to content

1.1.0-beta

1.1.0-beta #9

Workflow file for this run

name: Publish Docker image
on:
push:
branches:
- "master"
- "main"
workflow_dispatch: # allows manual triggering
release:
types: [published]
jobs:
push_to_registry:
runs-on: ubuntu-latest
steps:
- name: Get current date
run: echo "curr_date=$(date --utc +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{github.event.release.tag_name }}
id: docker_build_release
uses: docker/build-push-action@v5
if: ${{ github.event.release.tag_name != '' }}
with:
pull: true
push: true
tags: ghcr.io/mangosango/clive:latest,ghcr.io/mangosango/clive:${{ github.event.release.tag_name }}
platforms: linux/amd64,linux/arm64
provenance: false
build-args: |
VERSION=${{ github.event.release.tag_name }}
BUILD=${{ env.curr_date }}
- name: Check for commits in the last 24 hours
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV
if: ${{ github.event.release.tag_name == '' }}
- name: Build and push main
id: docker_build_main
uses: docker/build-push-action@v5
if: ${{ github.event.release.tag_name == '' && env.NEW_COMMIT_COUNT > 0 }}
with:
pull: true
push: true
tags: ghcr.io/mangosango/clive:main
platforms: linux/amd64,linux/arm64
provenance: false
build-args: |
VERSION=main
BUILD=${{ env.curr_date }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}