-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.7 KB
/
release.yml
File metadata and controls
68 lines (57 loc) · 1.7 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
name: Release
on:
workflow_dispatch:
inputs:
prerelease:
description: 'Create a prerelease'
required: false
type: boolean
default: false
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
concurrency: release
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install dependencies
run: uv sync --frozen --dev --no-group prod
- name: Python Semantic Release
id: release
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if [ "${{ inputs.prerelease }}" = "true" ]; then
uv run semantic-release version --prerelease
else
uv run semantic-release version
fi
# Check if a new version was created by looking at git tags
if git describe --exact-match HEAD 2>/dev/null; then
echo "released=true" >> $GITHUB_OUTPUT
else
echo "released=false" >> $GITHUB_OUTPUT
fi
- name: Publish Release
if: steps.release.outputs.released == 'true'
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: uv run semantic-release publish