-
Notifications
You must be signed in to change notification settings - Fork 12
92 lines (88 loc) · 2.57 KB
/
Copy pathrelease.yml
File metadata and controls
92 lines (88 loc) · 2.57 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
87
88
89
90
91
92
name: Release
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install UV
uses: astral-sh/setup-uv@v5
- name: Install Just
uses: taiki-e/install-action@just
- name: Create Venv
run: just dev
- name: Build Wheels
run: just dist
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist
release-pypi:
name: PyPI Release
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Wheels
uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: PyPI Release
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
release-gh:
name: GitHub Release
needs:
- release-pypi # we shouldn't release if releasing to pypi failed.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Release - Create or convert from draft
run: |
if gh release list | grep Draft; then
old_version="$(gh release list | grep Draft | head -1 | cut -f1)"
new_version="${{ github.ref_name }}"
body=$(gh release view "$old_version" --json body -q ".body" | sed "s/\.\.\.$old_version/...$new_version/g")
echo "$body";
gh release delete "$old_version"
gh release create "$new_version" --title "$new_version" --notes "$body";
echo Release "$new_version" was published from draft template.;
else
gh release create "$new_version" --title "$new_version";
echo Release "$new_version" was published.;
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Upload artifacts into release
uses: softprops/action-gh-release@v1
with:
files: dist/*
changelog:
name: Update changelog
needs:
- release-gh
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: rhysd/changelog-from-release/action@v3
with:
file: CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_summary_template: 'update changelog for ${{ github.ref_name }}'