Skip to content

Commit dcdf29b

Browse files
authored
publish packages based on git release (#119)
1 parent 325edcc commit dcdf29b

File tree

9 files changed

+34
-22
lines changed

9 files changed

+34
-22
lines changed

.github/workflows/cd-core.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: Core NPM publish
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
paths:
8-
- packages/core/**
9-
workflow_dispatch:
4+
release:
5+
types: [published]
106

117
jobs:
128
core-publish:
@@ -19,6 +15,12 @@ jobs:
1915
- run: yarn compile
2016
name: Compile smart contracts
2117
working-directory: ./packages/core
18+
- name: Change core version
19+
uses: jossef/action-set-json-field@v2
20+
with:
21+
file: ./packages/core/package.json
22+
field: version
23+
value: ${{ github.event.release.tag_name }}
2224
- uses: JS-DevTools/npm-publish@v1
2325
with:
2426
package: ./packages/core/package.json

.github/workflows/cd-node-sdk.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: Node.js SDK NPM publish
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
paths:
8-
- packages/sdk/typescript/human-protocol-sdk/**
9-
workflow_dispatch:
4+
release:
5+
types: [published]
106

117
jobs:
128
node-sdk-publish:
@@ -16,6 +12,12 @@ jobs:
1612
- uses: actions/checkout@v3
1713
- run: yarn --ignore-scripts
1814
name: Install dependencies
15+
- name: Change Node.js SDK version
16+
uses: jossef/action-set-json-field@v2
17+
with:
18+
file: ./packages/sdk/typescript/human-protocol-sdk/package.json
19+
field: version
20+
value: ${{ github.event.release.tag_name }}
1921
- uses: JS-DevTools/npm-publish@v1
2022
name: Publish
2123
with:

.github/workflows/cd-python-sdk.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: Python SDK publish
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
paths:
8-
- packages/sdk/python/**
9-
workflow_dispatch:
4+
release:
5+
types: [published]
106

117
jobs:
128
publish-python-sdk:
@@ -25,6 +21,13 @@ jobs:
2521
run: |
2622
python -m pip install --upgrade pip
2723
pip install setuptools wheel twine
24+
- name: Set the relase version
25+
uses: "DamianReeves/write-file-action@master"
26+
with:
27+
path: ./packages/sdk/python/human_protocol_sdk/__init__.py
28+
write-mode: overwrite
29+
contents: |
30+
__version__ = "${{ github.event.release.tag_name }}"
2831
- name: Build and publish
2932
working-directory: ./packages/sdk/python
3033
env:

.github/workflows/cd-subgraph.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- main
77
paths:
88
- packages/sdk/typescript/subgraph/**
9-
workflow_dispatch:
109

1110
jobs:
1211
subgraph:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.0.0"

packages/sdk/python/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[project]
2+
name = "human-protocol-sdk"
3+
dynamic = ["version"]
4+
5+
[tool.setuptools.dynamic]
6+
version = {attr = "human_protocol_sdk.__version__"}

packages/sdk/python/pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = -p no:warnings --doctest-modules

packages/sdk/python/setup.cfg

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

packages/sdk/python/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
setuptools.setup(
55
name="human-protocol-sdk",
6-
version="0.0.6",
76
author="HUMAN Protocol",
87
description="A python library to launch escrow contracts to the HUMAN network.",
98
url="https://github.com/humanprotocol/human-protocol/packages/sdk/python",

0 commit comments

Comments
 (0)