1
- name : Start a new release
1
+ name : Release and publish a new version
2
2
3
3
on :
4
4
workflow_dispatch :
27
27
run : |
28
28
echo "Job failed due to user not being a member of Giskard-AI organization and the 'safe for build' label not being set on the PR"
29
29
exit 1
30
+
31
+ - name : Write release version env vars (with/without v)
32
+ run : |
33
+ VERSION_NAME="v${{ inputs.version }}"
34
+ VERSION_NUMBER="${VERSION_NAME:1}"
35
+ echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_ENV
36
+ echo "VERSION_NAME=${VERSION_NAME}" >> $GITHUB_ENV
30
37
31
38
- name : Checkout code
32
39
36
43
token : ${{ secrets.RELEASE_PAT_TOKEN }} # Needed to trigger other actions
37
44
38
45
- name : Edit pyproject.toml
39
- run : sed -i 's/^\(version *= *\).*$/\1"${{ inputs.version }}"/' pyproject.toml
46
+ run : sed -i 's/^\(version *= *\).*$/\1"${{ env.VERSION_NUMBER }}"/' pyproject.toml
40
47
41
48
- name : Remove dark theme logo from README
42
49
run : sed -i 's/.*#gh-dark-mode-only.*//' README.md
@@ -47,36 +54,74 @@ jobs:
47
54
python-version : ' 3.10'
48
55
cache : false
49
56
50
- - name : Build release candidate wheel
51
- run : pdm build
52
-
53
- - name : Upload RC wheel artifact
54
- uses : actions/upload-artifact@v4
55
- with :
56
- name : rc-wheel-${{ inputs.version }}
57
- path : dist/*whl
58
- if-no-files-found : error
59
- retention-days : 1
60
-
61
57
- name : " @slack Release process started"
62
58
id : slack
63
59
64
60
with :
65
61
channel-id : ${{ vars.SLACK_CHANNEL_ID }}
66
62
slack-message : |-
67
- Release *v ${{ inputs.version }}* is on the way :rocket:
63
+ Release *${{ env.VERSION_NAME }}* is on the way :rocket:
68
64
<${{ github.server_url }}/${{ github.actor }}|@${{ github.actor }}> | <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|commit> <!channel>
69
65
env :
70
66
SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
71
67
72
- - name : Trigger release process in legacy-hub
73
- uses : peter-evans/repository-dispatch@v3
68
+ - name : Configure git
69
+ run : |
70
+ git config --global user.name 'BotReleaser'
71
+ git config --global user.email '[email protected] '
72
+
73
+ - name : Adding file
74
+ run : |
75
+ git add pyproject.toml
76
+ git fetch --quiet --tags
77
+ git commit -m "${{ env.VERSION_NAME }}" --allow-empty
78
+ git tag ${{ env.VERSION_NAME }}
79
+
80
+ - name : Push to main and tags
81
+ run : |
82
+ git push origin main
83
+ git push origin ${{ env.VERSION_NAME }}
84
+
85
+ # build .tar.gz sdist tarball
86
+ - name : Build source distribution tarball
87
+ run : pdm build
88
+
89
+ - name : Create Github Release
90
+ id : github-release
91
+ uses : softprops/action-gh-release@v2
92
+ with :
93
+ tag_name : ${{ env.VERSION_NAME }}
94
+ fail_on_unmatched_files : true
95
+ generate_release_notes : true
96
+ files : |
97
+ dist/giskard-*.tar.gz
98
+ dist/giskard-*.whl
99
+
100
+ - name : Push to Pipy
101
+ run : pdm publish --no-build --username "${{ secrets.PIPY_USERNAME }}" --password "${{ secrets.PIPY_PASSWORD }}"
102
+
103
+ - name : Set job success env var
104
+ run : |
105
+ echo "JOB_SUCCESS=true" >> $GITHUB_ENV
106
+
107
+ - name : " @slack Share release process completion"
108
+ # cancellable always() https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions
109
+ if : ${{ !cancelled() }}
110
+
111
+ env :
112
+ SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
113
+ ON_SUCCESS : |-
114
+ *${{ env.VERSION_NAME }}* has been published to PyPI ! :python: :tada:
115
+ <${{ steps.github-release.outputs.url }}|Release notes> | <https://pypi.org/project/giskard/${{ env.VERSION_NUMBER }}|PyPI> <!channel>
116
+ ON_FAILURE : |-
117
+ Could not publish *${{ env.VERSION_NAME }}* to PyPI :x:
118
+ <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|logs> <!channel>
74
119
with :
75
- token : ${{ secrets.RELEASE_PAT_TOKEN }}
76
- event-type : create-release
77
- repository : ${{ github.repository_owner }}/legacy-hub
78
- client- payload : |
120
+ channel-id : ${{ vars.SLACK_CHANNEL_ID }}
121
+ slack-message : ${{ env.JOB_SUCCESS == 'true' && env.ON_SUCCESS || env.ON_FAILURE }}
122
+ # reploy_broadcast == also send to channel
123
+ payload : |
79
124
{
80
- "version_name ": "v ${{ inputs.version }}",
81
- "slack_thread_id ": "${{ steps.slack.outputs.thread_ts }}"
82
- }
125
+ "thread_ts ": "${{ steps.slack.outputs.thread_ts }}",
126
+ "reply_broadcast ": true
127
+ }
0 commit comments