-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (70 loc) · 1.99 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (70 loc) · 1.99 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:
push:
tags:
- 'v*'
jobs:
create-release:
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write # Required for trusted publishing
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Extract version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
run: |
# Generate changelog from commits since last tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
if [ -n "$PREVIOUS_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s" $PREVIOUS_TAG..HEAD)
else
CHANGELOG=$(git log --pretty=format:"- %s")
fi
# Save changelog to file
echo "$CHANGELOG" > changelog.txt
# Set output for use in release
{
echo "changelog<<EOF"
echo "$CHANGELOG"
echo "EOF"
} >> $GITHUB_OUTPUT
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
python -m build
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ env.VERSION }}
body: |
## Changes in ${{ env.VERSION }}
${{ steps.changelog.outputs.changelog }}
## Installation
```bash
pip install envlog==${{ env.VERSION }}
```
See [CHANGELOG.md](CHANGELOG.md) for full version history.
files: |
dist/*.tar.gz
dist/*.whl
draft: false
prerelease: false
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1