@@ -3,21 +3,31 @@ name: Upload Python Package
3
3
on :
4
4
push :
5
5
tags :
6
- - v*.**
6
+ - v*
7
+ branches :
8
+ - develop
9
+ pull_request :
10
+ branches :
11
+ - develop
7
12
workflow_dispatch :
8
13
9
14
permissions :
10
15
contents : read
11
16
12
17
jobs :
13
- build_wheels :
18
+ build-wheels :
14
19
name : Build wheels on ${{ matrix.os }}
15
20
runs-on : ${{ matrix.os }}
16
21
strategy :
17
22
matrix :
18
- os : [ubuntu-latest-8 , macos-latest]
23
+ os : [ubuntu-latest, macos-latest]
19
24
20
25
steps :
26
+ - name : Dump GitHub context
27
+ env :
28
+ GITHUB_CONTEXT : ${{ toJson(github) }}
29
+ run : echo "$GITHUB_CONTEXT"
30
+
21
31
- uses : actions/checkout@v4
22
32
with :
23
33
fetch-depth : 0
33
43
git branch
34
44
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
35
45
46
+ # TODO: add cbuildwheel cache
36
47
- name : Build release distributions
37
- run : |
38
- uv build --wheel
48
+ run : uv build --wheel
39
49
env :
40
50
HATCH_BUILD_HOOKS_ENABLE : true
41
51
@@ -45,107 +55,32 @@ jobs:
45
55
path : dist/
46
56
47
57
release :
48
- needs : build_wheels
49
- runs-on : ubuntu-latest-8
50
- permissions :
51
- contents : write
58
+ if : startsWith(github.ref, 'refs/tags/')
59
+ needs : build-wheels
60
+ runs-on : ubuntu-latest
52
61
environment : release
53
62
steps :
54
63
- uses : actions/checkout@v4
55
64
56
65
- name : Setup backend
57
66
uses : ./.github/actions/setup-backend
58
67
59
- - name : Configure AWS Credentials
60
- uses : aws-actions/configure-aws-credentials@v4
61
- with :
62
- aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
63
- aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
64
- aws-region : us-west-1
65
-
66
68
- name : Download All Artifacts
67
69
uses : actions/download-artifact@v4
68
70
with :
69
71
path : dist
70
72
merge-multiple : true
71
73
pattern : wheels-*
72
74
75
+ - name : Release PyPI
76
+ run : |
77
+ export UV_PUBLISH_PASSWORD="${{ secrets.PYPI_TOKEN }}"
78
+ export UV_PUBLISH_USERNAME="__token__"
79
+ uv publish --publish-url https://upload.pypi.org/legacy/ --keyring-provider disabled
80
+
73
81
- name : Make github release
74
82
uses : softprops/action-gh-release@v2
75
- if : startsWith(github.ref, 'refs/tags/')
76
83
with :
77
84
files : dist/*
78
85
fail_on_unmatched_files : true
79
86
generate_release_notes : true
80
-
81
- - name : Publish message to slack
82
-
83
- if : success() && startsWith(github.ref, 'refs/tags/')
84
- with :
85
- webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
86
- webhook-type : incoming-webhook
87
- payload : |
88
- {
89
- "blocks": [
90
- {
91
- "type": "header",
92
- "text": {
93
- "type": "plain_text",
94
- "text": "✅ New codegen-sdk Release Successfully Published! 🚀",
95
- "emoji": true
96
- }
97
- },
98
- {
99
- "type": "section",
100
- "text": {
101
- "type": "mrkdwn",
102
- "text": "*Version:* ${{ github.ref_name }}\n*Released by:* <${{ github.server_url }}/${{ github.actor }}|@${{ github.actor }}>\n\n*Links:*\n• <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|GitHub Release>\n• <https://pypi.org/project/codegen-sdk/${{ github.ref_name }}|PyPI Package>"
103
- }
104
- },
105
- {
106
- "type": "context",
107
- "elements": [
108
- {
109
- "type": "mrkdwn",
110
- "text": "<!date^${{ github.event.release.published_at }}^Published {date_num} at {time}|Published just now>"
111
- }
112
- ]
113
- }
114
- ]
115
- }
116
-
117
- - name : Publish failed message to slack
118
-
119
- if : failure() && startsWith(github.ref, 'refs/tags/')
120
- with :
121
- webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
122
- webhook-type : incoming-webhook
123
- payload : |
124
- {
125
- "blocks": [
126
- {
127
- "type": "header",
128
- "text": {
129
- "type": "plain_text",
130
- "text": "❌ codegen-sdk Release Failed",
131
- "emoji": true
132
- }
133
- },
134
- {
135
- "type": "section",
136
- "text": {
137
- "type": "mrkdwn",
138
- "text": "*Version:* ${{ github.ref_name }}\n*Attempted by:* <${{ github.server_url }}/${{ github.actor }}|@${{ github.actor }}>\n\n*Details:*\n• Failed to publish version ${{ github.ref_name }}\n• <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run>"
139
- }
140
- },
141
- {
142
- "type": "context",
143
- "elements": [
144
- {
145
- "type": "mrkdwn",
146
- "text": "Failed at <!date^${{ github.event.release.published_at }}^{date_num} {time}|just now>"
147
- }
148
- ]
149
- }
150
- ]
151
- }
0 commit comments