-
Notifications
You must be signed in to change notification settings - Fork 44
69 lines (66 loc) · 2.26 KB
/
cd-python-sdk.yaml
File metadata and controls
69 lines (66 loc) · 2.26 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
name: Python SDK publish
permissions:
contents: write
on:
workflow_dispatch:
inputs:
push_git_tags:
description: "Push git tags after publishing (true/false)"
required: false
default: "false"
push:
branches:
- main
paths:
- "packages/sdk/python/human-protocol-sdk/**"
jobs:
publish-python-sdk:
name: Publish Python SDK
runs-on: ubuntu-latest
env:
PUSH_GIT_TAGS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.push_git_tags || 'true' }}
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.RELEASE_GH_TOKEN }}
- name: Setup git identity
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: yarn
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Read package version
id: read_version
run: |
VERSION=$(jq -r '.version' packages/sdk/python/human-protocol-sdk/package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Install build deps
working-directory: ./packages/sdk/python/human-protocol-sdk
run: |
python -m pip install --upgrade pip
pip install setuptools==68.2.2 wheel twine
- name: Build and publish
working-directory: ./packages/sdk/python/human-protocol-sdk
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: make publish-package
- name: Create and push tag
if: ${{ env.PUSH_GIT_TAGS == 'true' }}
working-directory: ./packages/sdk/python/human-protocol-sdk
run: |
VERSION="${{ steps.read_version.outputs.version }}"
TAG="python/sdk@${VERSION}"
echo "Version: $VERSION | Tag: $TAG"
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
echo "Tag ${TAG} already exists. Skipping tag creation."
exit 0
fi
git tag -a "$TAG" -m "Python SDK $VERSION"
git push origin --tags