-
Notifications
You must be signed in to change notification settings - Fork 5
86 lines (71 loc) · 2.23 KB
/
release.yml
File metadata and controls
86 lines (71 loc) · 2.23 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
name: Release
on:
workflow_call:
# This workflow is deprecated since the introduction of the `commit_version_tag.yml` workflow.
# Keeping it for now until the new version has been tested.
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
env:
PYTHON_VERSION: '3.12'
jobs:
test:
uses: ./.github/workflows/test_build.yml
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Get version info
id: version
run: |
VERSION=$(python scripts/version_manager.py --get)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Update VERSION file for main branch
run: |
python scripts/version_manager.py --update-for-branch main
- name: Prepare version for build
run: |
python scripts/prepare_version.py
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
body: |
Release ${{ steps.version.outputs.version }}
## Changes
- See commit history for detailed changes
## Installation
```bash
pip install hatchling==${{ steps.version.outputs.version }}
```
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Commit updated VERSION file
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add VERSION
git diff --staged --quiet || git commit -m "Update VERSION file for release ${{ steps.version.outputs.version }}"
git push