Skip to content

Create Release

Create Release #38

Workflow file for this run

on:
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v1.7.0)"
required: true
type: string
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Release
permissions:
contents: write
jobs:
autorelease:
name: Create Release
runs-on: "ubuntu-latest"
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.tag || github.ref }}
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Add version to environment vars
run: |
PROJECT_VERSION=$(uvx dunamai from any --format "{base}")
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
- name: Check if tag version matches project version
run: |
TAG=${{ inputs.tag || '' }}
if [[ -z "$TAG" ]]; then
TAG=$(git describe HEAD --tags --abbrev=0)
fi
echo $TAG
echo $PROJECT_VERSION
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi
- name: Install deps
run: uv sync --frozen
- name: Run tests
run: uv run --no-sync pytest -v
- name: Build
run: uv build
- name: Create Release Draft
uses: softprops/action-gh-release@v2.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.tag || github.ref_name }}
name: Release ${{ inputs.tag || github.ref_name }}
draft: true
generate_release_notes: true
files: |
dist/taskbadger-${{env.PROJECT_VERSION}}-py3-none-any.whl
dist/taskbadger-${{env.PROJECT_VERSION}}.tar.gz