-
Notifications
You must be signed in to change notification settings - Fork 101
130 lines (111 loc) · 3.23 KB
/
Copy pathrelease.yml
File metadata and controls
130 lines (111 loc) · 3.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.9.8"
- name: Build source and wheel distributions
run: uv build
- name: Twine check
run: uvx twine check dist/*
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
publish-testpypi:
if: contains(github.ref_name, 'rc')
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/nested-learning
steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to TestPyPI via Trusted Publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/
publish-pypi:
if: ${{ !contains(github.ref_name, 'rc') }}
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nested-learning
steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to PyPI via Trusted Publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
publish-github-release:
needs:
- build
- publish-testpypi
- publish-pypi
if: |
always() &&
needs.build.result == 'success' &&
(needs.publish-testpypi.result == 'success' || needs.publish-testpypi.result == 'skipped') &&
(needs.publish-pypi.result == 'success' || needs.publish-pypi.result == 'skipped')
runs-on: ubuntu-latest
steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Generate checksums
run: |
cd dist
sha256sum * > SHA256SUMS.txt
- name: Build release preamble
run: |
cat > release_preamble.md <<EOF
Package release for \`${GITHUB_REF_NAME}\`.
Install:
\`\`\`bash
pip install nested-learning==${GITHUB_REF_NAME#v}
\`\`\`
Included assets:
- source distribution (`.tar.gz`)
- wheel (`.whl`)
- \`SHA256SUMS.txt\` checksums
For compatibility/support details:
- https://github.com/${GITHUB_REPOSITORY}/blob/main/docs/COMPATIBILITY_MATRIX.md
- https://github.com/${GITHUB_REPOSITORY}/blob/main/docs/VERSIONING_POLICY.md
EOF
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ contains(github.ref_name, 'rc') }}
generate_release_notes: true
body_path: release_preamble.md
files: |
dist/*