-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (79 loc) · 2.31 KB
/
release.yml
File metadata and controls
93 lines (79 loc) · 2.31 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
name: Release to PyPI
on:
release:
types: [published]
permissions:
contents: read
jobs:
release-notes:
name: Populate release notes from CHANGELOG.md
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update release body
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name }}
run: |
version="${TAG#v}"
python3 .ci/changelog-notes "$version" > /tmp/release-notes.md
gh release edit "$TAG" --notes-file /tmp/release-notes.md
build:
name: Build distribution packages
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build package
run: uv build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.run_id }}
path: dist/
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
if: "!github.event.release.prerelease"
permissions:
contents: read
id-token: write
environment:
name: release
url: https://pypi.org/project/shellgenius/
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist-${{ github.run_id }}
path: dist/
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Check release tag
id: stable_tag
env:
TAG: ${{ github.event.release.tag_name }}
run: |
if [[ "$TAG" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "publish=true" >>"$GITHUB_OUTPUT"
exit 0
fi
echo "::notice::Skipping publish for non-stable tag: $TAG"
echo "publish=false" >>"$GITHUB_OUTPUT"
- name: Publish to PyPI with uv
if: steps.stable_tag.outputs.publish == 'true'
run: uv publish --trusted-publishing always --check-url https://pypi.org/simple