-
Notifications
You must be signed in to change notification settings - Fork 12
99 lines (81 loc) · 3.11 KB
/
prepare-release.yml
File metadata and controls
99 lines (81 loc) · 3.11 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# .github/workflows/prepare-release.yml
name: Prepare Release
permissions:
contents: write # Grants write access to repository contents (required for creating releases)
pull-requests: write
on:
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up uv with Python 3.12
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.12
activate-environment: true
enable-cache: true
- name: Install bump-my-version
run: uv pip install bump-my-version
- name: Setup git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Generate unique branch name
id: create_branch
run: |
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
BRANCH="prepare-release-$TIMESTAMP"
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Bump version
id: bump_version
run: |
# Get current version before bump
CURRENT_VERSION=$(bump-my-version show current_version)
echo "previous-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
# Bump version
bump-my-version bump release --commit
# Get new version after bump
NEW_VERSION=$(bump-my-version show current_version)
echo "current-version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Build package
id: build
run: |
uv build --no-sources .
echo "WHEEL_FILE=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
echo "TAR_FILE=$(ls dist/*.tar.gz)" >> $GITHUB_OUTPUT
- name: Create Draft Release
uses: softprops/action-gh-release@v3
with:
files: |
${{ steps.build.outputs.WHEEL_FILE }}
${{ steps.build.outputs.TAR_FILE }}
draft: true
name: "Release ${{ steps.bump_version.outputs.current-version }}"
tag_name: ${{ steps.bump_version.outputs.current-version }}
body: |
## Release ${{ steps.bump_version.outputs.current-version }}
*Release notes will be added here*
### Artifacts
- Python wheel package
- Source distribution
- name: Create PR
id: create-pr
uses: peter-evans/create-pull-request@v8
with:
title: "Release ${{ steps.bump_version.outputs.current-version }}"
body: |
# Release ${{ steps.bump_version.outputs.current-version }}
This PR prepares release ${{ steps.bump_version.outputs.current-version }}.
## Manual steps after review:
1. Merge this PR
2. Create a tag with the release version on the merged commit
3. Finalize the release on GitHub
The tag will trigger Docker image build automatically.
branch: ${{ steps.create_branch.outputs.branch }}
base: main