Check tag consistency as a requirement to publishing #774
Workflow file for this run
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: Docker image CI | |
on: | |
pull_request: | |
branches: | |
- "**" | |
# synchronized is when you push new commits | |
types: ["opened", "synchronize"] | |
push: | |
branches: | |
- main | |
# required to enable manual triggers on the GH web ui | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check for modified paths | |
uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
rebuild: | |
- '.github/**' | |
- 'lumigator/**' | |
- name: Get repo version | |
if: steps.filter.outputs.rebuild == 'true' | |
run: | | |
echo "REPOVERSION=$(git describe --tags --dirty --match \"[0-9\.]*\" --always)" >> $GITHUB_ENV | |
echo "Version of the repo for this build: $REPOVERSION" | |
- name: Set up QEMU | |
if: steps.filter.outputs.rebuild == 'true' | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker buildx | |
if: steps.filter.outputs.rebuild == 'true' | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: steps.filter.outputs.rebuild == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
if: steps.filter.outputs.rebuild == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
target: "main_image" | |
tags: | | |
mzdotai/lumigator:backend_dev_${{ env.REPOVERSION }} | |
${{ github.ref == 'refs/heads/main' && 'mzdotai/lumigator:latest' || '' }} |