Skip to content
This repository was archived by the owner on Jun 28, 2026. It is now read-only.

Next iteration 🪄 #2

Next iteration 🪄

Next iteration 🪄 #2

Workflow file for this run

# Python-Boilerplate/.github/workflows/build.yml
name: build
on:
push:
branches: ['main']
release:
types: [published]
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: '1.8.4'
- name: Install dependencies
run: poetry install
- name: Run tests
run: poetry run pytest
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=sha
type=ref,event=tag
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APP_VERSION=${{ github.ref_name }}
APP_COMMIT=${{ github.sha }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
- name: Smoke test container
run: |
docker run -d --name app-test -p 8000:8000 ${{ env.IMAGE_NAME }}:latest
sleep 5
curl -f http://127.0.0.1:8000/metrics | head -n 20
docker rm -f app-test