generated from Diapolo10/python-poetry-template
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (80 loc) · 2.49 KB
/
github_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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# This workflow automatically creates a GitHub release for the project on successful version update
name: Create a GitHub release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build Binaries for ${{ matrix.os }}-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [
'3.11',
# 'pypy-3.10',
]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v9
- name: Install library and dependencies
run: |
poetry run pip install --upgrade pip setuptools
poetry install
- name: Build releases
run: |
poetry build
- name: Upload builds
uses: actions/upload-artifact@v4
with:
name: built-binary
path: |
dist/*.whl
dist/*.tar.gz
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: built-binary
- name: Check Version
uses: nowsprinting/check-version-format-action@v4
id: version
with:
prefix: 'v'
- name: Check for Pre-release
uses: haya14busa/action-cond@v1
id: is_prerelease
with:
cond: ${{ steps.version.outputs.prerelease != '' }}
if_true: true
if_false: false
- name: Get Newest Changelog
run: |
python -c "import re; from pathlib import Path; text=re.sub('<!--(.*?)-->', '', (Path.cwd() / 'CHANGELOG.md').read_text(), flags=re.DOTALL); start=text.find('_' * 79); (Path.cwd() / 'TEMP_CHANGELOG.md').write_text(text[start:text.find('_' * 79, start+1)])"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: ${{ steps.is_prerelease.outputs.value }}
body_path: ./TEMP_CHANGELOG.md
files: |
*.whl
*.tar.gz