You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.4 KiB
80 lines
2.4 KiB
name: Release package
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release-type:
|
|
type: choice
|
|
description: 'Release type (one of): patch, minor, major, prepatch, preminor, premajor, prerelease'
|
|
default: 'patch'
|
|
options:
|
|
- 'patch'
|
|
- 'minor'
|
|
- 'major'
|
|
required: true
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Checkout project repository
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
with:
|
|
version: "latest"
|
|
- name: Install dependencies
|
|
run: |
|
|
uv sync
|
|
- name: Run Python lint checks
|
|
run: |
|
|
uv run pre-commit run --all-files
|
|
- name: Run Python tests
|
|
run: |
|
|
uv run pytest --cov
|
|
- name: Git configuration
|
|
run: |
|
|
git config --global user.email "bot@example.com"
|
|
git config --global user.name "GitHub Actions"
|
|
- name: Bump release version
|
|
run: |
|
|
uvx hatch version ${{ github.event.inputs.release-type }}
|
|
echo "NEW_VERSION=$(uvx hatch version)" >> $GITHUB_ENV
|
|
env:
|
|
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
|
|
- name: Build package
|
|
run: |
|
|
uv lock
|
|
uv build
|
|
- name: Commit pyproject.toml and uv.lock
|
|
run: |
|
|
git add pyproject.toml uv.lock
|
|
git commit -m "chore: release ${{ env.NEW_VERSION }}"
|
|
git tag ${{ env.NEW_VERSION }}
|
|
git push origin master
|
|
- name: Build docker image
|
|
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
|
with:
|
|
context: .
|
|
push: false
|
|
platforms: linux/amd64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
# Push repository changes
|
|
- name: Publish package
|
|
run: |
|
|
uv publish
|
|
env:
|
|
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
- name: Push docker image
|
|
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
|
with:
|
|
context: .
|
|
push: false
|
|
platforms: linux/amd64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|