Skip to content

Commit 437e8a4

Browse files
Merge pull request #17 from superstreamlabs/master
release
2 parents 7b69448 + eaca573 commit 437e8a4

File tree

8 files changed

+260
-215
lines changed

8 files changed

+260
-215
lines changed

.github/workflows/release.yaml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Release Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- latest
8+
9+
jobs:
10+
beta-release:
11+
name: Beta Release
12+
runs-on: ubuntu-latest
13+
if: github.ref == 'refs/heads/master'
14+
outputs:
15+
version: ${{ steps.get_version.outputs.version }}
16+
status: ${{ job.status }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.11'
26+
27+
- name: Install dependencies
28+
run: |
29+
pip install --quiet build twine toml
30+
31+
- name: Modify package name for beta
32+
run: |
33+
sed -i -E 's/^(name *= *")superstream-clients(")/\1superstream-clients-beta\2/' pyproject.toml
34+
35+
- name: Build package
36+
run: python -m build
37+
38+
- name: Publish to PyPI
39+
env:
40+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
41+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
42+
run: |
43+
twine upload dist/*
44+
45+
- name: Get version
46+
if: always()
47+
id: get_version
48+
run: |
49+
VERSION=$(python3 -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
50+
echo "version=$VERSION" >> $GITHUB_OUTPUT
51+
52+
prod-release:
53+
name: Production Release
54+
runs-on: ubuntu-latest
55+
if: github.ref == 'refs/heads/latest'
56+
outputs:
57+
version: ${{ steps.get_version.outputs.version }}
58+
status: ${{ job.status }}
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
63+
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: '3.11'
68+
69+
- name: Install dependencies
70+
run: |
71+
pip install --quiet build twine toml
72+
73+
- name: Build package
74+
run: python -m build
75+
76+
- name: Publish to PyPI
77+
env:
78+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
79+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
80+
run: |
81+
twine upload dist/*
82+
83+
- name: Get version from pyproject.toml
84+
if: always()
85+
id: get_version
86+
run: |
87+
VERSION=$(python3 -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
88+
echo "version=$VERSION" >> $GITHUB_OUTPUT
89+
echo "Version: $VERSION"
90+
91+
- name: Create Git tag
92+
run: |
93+
git config user.email "[email protected]"
94+
git config user.name "GitHub Actions"
95+
git tag -a ${{ steps.get_version.outputs.version }} -m "${{ steps.get_version.outputs.version }}"
96+
git push origin ${{ steps.get_version.outputs.version }}
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
100+
- name: Create GitHub Release
101+
uses: softprops/action-gh-release@v1
102+
with:
103+
tag_name: ${{ steps.get_version.outputs.version }}
104+
files: dist/superstream_clients-${{ steps.get_version.outputs.version }}.tar.gz
105+
generate_release_notes: true
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
109+
notify:
110+
name: Send Notifications
111+
runs-on: ubuntu-latest
112+
needs: prod-release
113+
if: always() && github.ref == 'refs/heads/latest'
114+
115+
steps:
116+
- name: Send Slack notification on success
117+
if: needs.prod-release.result == 'success'
118+
uses: slackapi/slack-github-action@v1
119+
with:
120+
payload: |
121+
{
122+
"text": "superstream-python-clients v${{ needs.prod-release.outputs.version }} Production Release SUCCESSFUL ✅",
123+
"blocks": [
124+
{
125+
"type": "section",
126+
"text": {
127+
"type": "mrkdwn",
128+
"text": "*superstream-python-clients v${{ needs.prod-release.outputs.version }} Production Release SUCCESSFUL* ✅\n*Branch:* ${{ github.ref_name }}\n*Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>\n*Author:* ${{ github.event.head_commit.author.name }}\n*Release:* <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ needs.prod-release.outputs.version }}|View Release>"
129+
}
130+
}
131+
]
132+
}
133+
env:
134+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
135+
continue-on-error: true
136+
137+
- name: Send Slack notification on failure
138+
if: needs.prod-release.result == 'failure'
139+
uses: slackapi/slack-github-action@v1
140+
with:
141+
payload: |
142+
{
143+
"text": "superstream-python-clients v${{ needs.prod-release.outputs.version }} Production Release FAILED ❌",
144+
"blocks": [
145+
{
146+
"type": "section",
147+
"text": {
148+
"type": "mrkdwn",
149+
"text": "*superstream-python-clients v${{ needs.prod-release.outputs.version }} Production Release FAILED* ❌\n*Branch:* ${{ github.ref_name }}\n*Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>\n*Author:* ${{ github.event.head_commit.author.name }}\n*Workflow Run:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>"
150+
}
151+
}
152+
]
153+
}
154+
env:
155+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
156+
continue-on-error: true
157+
158+
- name: Send Slack notification on cancellation
159+
if: needs.prod-release.result == 'cancelled'
160+
uses: slackapi/slack-github-action@v1
161+
with:
162+
payload: |
163+
{
164+
"text": "superstream-python-clients v${{ needs.prod-release.outputs.version }} Production Release ABORTED ⚠️",
165+
"blocks": [
166+
{
167+
"type": "section",
168+
"text": {
169+
"type": "mrkdwn",
170+
"text": "*superstream-python-clients v${{ needs.prod-release.outputs.version }} Production Release ABORTED* ⚠️\n*Branch:* ${{ github.ref_name }}\n*Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>\n*Author:* ${{ github.event.head_commit.author.name }}"
171+
}
172+
}
173+
]
174+
}
175+
env:
176+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
177+
continue-on-error: true

Jenkinsfile

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)