Skip to content

Release

Release #17

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (leave empty for next patch, e.g. 3.0.2 → 3.0.3)'
required: false
type: string
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Determine version
id: version
run: |
if [ -n "${{ inputs.version }}" ]; then
echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
CURRENT=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
NEXT=$(python3 -c "v='$CURRENT'.split('.'); v[-1]=str(int(v[-1])+1); print('.'.join(v))")
echo "VERSION=$NEXT" >> $GITHUB_OUTPUT
echo "Auto-incremented: $CURRENT → $NEXT"
fi
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Lint
run: ruff check . && ruff format --check .
- name: Run tests
run: python -m pytest --cov=app tests/ --cov-report=term
- name: Update version in pyproject.toml
run: |
sed -i "s/^version = \".*\"/version = \"${{ steps.version.outputs.VERSION }}\"/" pyproject.toml
echo "Updated pyproject.toml to version ${{ steps.version.outputs.VERSION }}"
grep '^version' pyproject.toml
- name: Create git tag
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add pyproject.toml
git commit -m "Release v${{ steps.version.outputs.VERSION }}" || echo "No version change needed"
git tag "v${{ steps.version.outputs.VERSION }}"
git push origin main "v${{ steps.version.outputs.VERSION }}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push multi-arch image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
push: true
tags: |
schowave/churchtools:${{ steps.version.outputs.VERSION }}
schowave/churchtools:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
generate_release_notes: true