-
Notifications
You must be signed in to change notification settings - Fork 33
61 lines (59 loc) · 2.15 KB
/
Copy pathdraft_release.yml
File metadata and controls
61 lines (59 loc) · 2.15 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
name: Draft a release
on:
workflow_dispatch:
inputs:
version:
description: 'The version number (e.g. 1.2.3) OR one of: patch|minor|major|prepatch|preminor|premajor|prerelease'
required: true
default: 'patch'
jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: ./.github/actions/python-poetry-env
- name: Update version
id: updated_version
shell: bash
run: |
# Update version in pyproject.toml
if [[ "${{ github.event.inputs.version }}" =~ ^[0-9] ]]; then
version="${{ github.event.inputs.version }}"
else
echo "Semantic version bumps (patch/minor/major) require manual edit with uv"
exit 1
fi
sed -i "s/^version = .*/version = \"$version\"/" pyproject.toml
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Update changelog
id: changelog
shell: bash
run: |
uv run kacl-cli release ${{ steps.updated_version.outputs.version }} --modify --auto-link
echo "" >> CHANGELOG.md
body=$(uv run kacl-cli get ${{ steps.updated_version.outputs.version }})
echo "body<<EOF" >> "$GITHUB_OUTPUT"
echo "$body" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
add: 'CHANGELOG.md pyproject.toml'
message: 'Release ${{ steps.updated_version.outputs.version }}'
- name: Create tag
run: |
git tag ${{ steps.updated_version.outputs.version }}
git push --tags
- name: Create a draft release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.updated_version.outputs.version }}
name: Release ${{ steps.updated_version.outputs.version }}
body: ${{ steps.changelog.outputs.body }}
draft: true