-
Notifications
You must be signed in to change notification settings - Fork 13
43 lines (43 loc) · 1.34 KB
/
release.yaml
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
name: Release
on:
push:
tags: ["v*"]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Check prerelease
id: check_version
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/v[0-9.]+rc[0-9]+$ ]]; then
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
fi
- name: Get Changelog
id: get-changelog
run: |
tags=$(git tag --sort=-version:refname | head -n 2 | awk '{print $1}')
tag_from=$(echo "$tags" | sed -n '2p')
tag_to=$(echo "$tags" | sed -n '1p')
git log --oneline --decorate "${tag_from}..${tag_to}" | tail -n +2 | awk '{print "* "$0}' > .changelog.md
- name: Create Release
uses: actions/create-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: .changelog.md
draft: false
prerelease: ${{ steps.check_version.outputs.PRERELEASE }}
- name: Set up PDM
run: pip install pdm==2.10.4
- name: Publish package distributions to PyPI
run: pdm publish -u "__token__" -P ${{ secrets.TWINE_PASSWORD }}