Skip to content

ci: fix bake file and gha steps #76

ci: fix bake file and gha steps

ci: fix bake file and gha steps #76

Workflow file for this run

name: Publish Docker image
on:
push:
branches:
- 'main'
- 'master'
tags:
- '*.*.*'
paths:
# Application code
- 'app/**'
- 'bin/**'
- 'config/**'
- 'tests/**'
- 'static/**'
# Docker and environment configs
- 'Dockerfile*'
- 'docker-compose.yml'
- 'docker-bake.hcl'
- '.dockerignore'
- '.env.example'
# Dependencies and python configs
- 'requirements.txt'
- 'pyproject.toml'
- 'uv.lock'
# Workflow files
- '.github/workflows/**'
# Shell scripts
- '**/*.py'
- '**/*.sh'
- '**/*.js'
- '**/*.css'
# workflow_run:
# workflows: ["Run pytest"]
# types:
# - completed
env:
REGISTRY_URL: ghcr.io
REGISTRY_USER: ${{ github.repository_owner }}
IMAGE_NAME: ${{ vars.IMAGE || 'meetup_bot' }}
jobs:
build-and-push:
name: Build and push Docker image
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }}
type=ref,event=branch,enable=${{ !endsWith(github.ref, 'main') }}
type=semver,pattern={{version}}
flavor: |
latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Build and push with Docker Bake
uses: docker/bake-action@v6
with:
files: ./docker-bake.hcl
targets: multi-platform
push: ${{ github.event_name != 'pull_request' }}
set: |
*.tags=${{ steps.meta.outputs.tags }}
*.cache-from=type=gha,scope=${{ github.workflow }}
*.cache-to=type=gha,mode=max,scope=${{ github.workflow }}
*.platform=linux/amd64,linux/arm64
*.args.PYTHON_VERSION=3.11
REGISTRY_URL=${{ env.REGISTRY_URL }}
REGISTRY_USER=${{ env.REGISTRY_USER }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
TAG=${{ steps.meta.outputs.version }}
DOCKERFILE=Dockerfile.web