-
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (54 loc) · 1.76 KB
/
create-draft-release.yml
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: create_draft_release
# yamllint disable rule:line-length
on:
workflow_dispatch:
# set the run-name
run-name: ${{ github.ref_name }} -> create_draft_release (
${{ github.run_attempt }}
)
jobs:
create_draft_release:
name: create_draft_release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Echo current date and time
id: datetime
run: |
echo "datetime: $(date '+%Y-%m-%d %H:%M:%S')"
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Update pip and install hatch
run: |
export PIP_ROOT_USER_ACTION=ignore
pip install --upgrade pip
pip install hatch
- name: Get version
id: get_version
run: |
export version=$(hatch version)
echo "version=$version" >> $GITHUB_OUTPUT
#validates that the version is a valid semver
- name: Validate version
id: validate_version
run: |
if [[ ! ${{ steps.get_version.outputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version: ${{ steps.get_version.outputs.version }}"
exit 1
fi
- name: Create release branch
run: |
git checkout -b "release/v${{ steps.get_version.outputs.version }}"
git push origin "release/v${{ steps.get_version.outputs.version }}"
- name: Create DRAFT release through github cli and upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.get_version.outputs.version }} --title v${{ steps.get_version.outputs.version }} --generate-notes --draft