File tree Expand file tree Collapse file tree 2 files changed +82
-43
lines changed
Expand file tree Collapse file tree 2 files changed +82
-43
lines changed Original file line number Diff line number Diff line change 1+ name : Publish to PyPI
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v[0-9]+.[0-9]+.[0-9]+*'
7+ workflow_dispatch :
8+ inputs :
9+ tag :
10+ description : ' Git tag to publish (e.g., v1.0.0)'
11+ required : true
12+ type : string
13+ ref :
14+ description : ' Branch or commit to checkout'
15+ required : false
16+ default : ' main'
17+ type : string
18+
19+ jobs :
20+ test :
21+ runs-on : ubuntu-latest
22+ steps :
23+ - name : Checkout
24+ uses : actions/checkout@v4
25+ with :
26+ fetch-depth : 0
27+ ref : ${{ github.event.inputs.ref || github.ref }}
28+
29+ - name : Setup Python
30+ uses : actions/setup-python@v5
31+ with :
32+ python-version : " 3.12"
33+
34+ - name : Install Python dependencies
35+ run : |
36+ python -m pip install --upgrade pip
37+ pip install -e .
38+
39+ - name : Run import test
40+ run : |
41+ python -c "import hatch; print('Hatch package imports successfully')"
42+
43+ publish-pypi :
44+ name : Publish to PyPI
45+ runs-on : ubuntu-latest
46+ needs : test
47+ environment :
48+ name : pypi
49+ url : https://pypi.org/project/hatch-xclam/
50+ permissions :
51+ id-token : write
52+
53+ steps :
54+ - name : Checkout
55+ uses : actions/checkout@v4
56+ with :
57+ fetch-depth : 0
58+ ref : ${{ github.event.inputs.ref || github.ref }}
59+
60+ - name : Checkout specific tag for manual dispatch
61+ if : github.event_name == 'workflow_dispatch'
62+ run : git checkout ${{ github.event.inputs.tag }}
63+
64+ - name : Setup Python
65+ uses : actions/setup-python@v5
66+ with :
67+ python-version : " 3.12"
68+
69+ - name : Install Python dependencies
70+ run : |
71+ python -m pip install --upgrade pip
72+ pip install build
73+
74+ - name : Build Python Package
75+ run : python -m build
76+
77+ - name : Publish to PyPI
78+ uses : pypa/gh-action-pypi-publish@release/v1
79+ with :
80+ print-hash : true
81+ verbose : true
82+ skip-existing : true
Original file line number Diff line number Diff line change 3232 release :
3333 needs : test
3434 runs-on : ubuntu-latest
35- if : github.event_name == 'push'
36- outputs :
37- released : ${{ steps.release.outputs.released }}
38- version : ${{ steps.release.outputs.version }}
39- tag : ${{ steps.release.outputs.tag }}
4035 steps :
4136 - name : Generate GitHub App Token
4237 id : generate_token
7065 git config user.name "github-actions[bot]"
7166 git config user.email "github-actions[bot]@users.noreply.github.com"
7267 npx semantic-release
73-
74- - name : Build Python Package
75- if : success()
76- run : |
77- python -m pip install build
78- python -m build
79-
80- - name : Upload Build Artifacts
81- if : success()
82- uses : actions/upload-artifact@v4
83- with :
84- name : dist-package
85- path : dist/
86- retention-days : 30
87-
88- publish-pypi :
89- name : Publish to PyPI
90- runs-on : ubuntu-latest
91- needs : [test, release]
92- if : success() && github.event_name == 'push'
93- environment :
94- name : pypi
95- url : https://pypi.org/project/hatch-xclam/
96- permissions :
97- id-token : write
98-
99- steps :
100- - name : Download Build Artifacts
101- uses : actions/download-artifact@v4
102- with :
103- name : dist-package
104- path : dist/
105-
106- - name : Publish to PyPI
107- uses : pypa/gh-action-pypi-publish@release/v1
108- with :
109- print-hash : true
110- verbose : true
You can’t perform that action at this time.
0 commit comments