-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (69 loc) · 2.02 KB
/
release.yml
File metadata and controls
72 lines (69 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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