Skip to content

Commit 9fdcf50

Browse files
authored
feat: add ci/cd workflow for the algod api clients (#76)
* feat(typescript/algod_api): package ts algod api client * feat(python/algod_api): package py algod api client * feat(typescript): publish to npm * chore: fix the release config
1 parent 308e7bf commit 9fdcf50

23 files changed

+1625
-262
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Convert to Python Version
2+
description: Converts a semantic version to Python PEP 440 format
3+
inputs:
4+
version:
5+
description: The semantic version to convert
6+
required: true
7+
outputs:
8+
version:
9+
description: The version in Python PEP 440 format
10+
value: ${{ steps.convert_version.outputs.version }}
11+
runs:
12+
using: "composite"
13+
steps:
14+
- id: convert_version
15+
shell: bash
16+
run: |
17+
NPMVER="${{ inputs.version }}"
18+
# Convert common prerelease formats
19+
# 1.2.3-alpha.1 -> 1.2.3a1
20+
# 1.2.3-beta.2 -> 1.2.3b2
21+
# 1.2.3-rc.1 -> 1.2.3rc1
22+
if [[ $NPMVER =~ ^([0-9]+\.[0-9]+\.[0-9]+)-([a-z]+)\.([0-9]+)$ ]]; then
23+
PREFIX=${BASH_REMATCH[1]}
24+
TYPE=${BASH_REMATCH[2]}
25+
NUM=${BASH_REMATCH[3]}
26+
27+
if [[ $TYPE == "alpha" ]]; then
28+
PYVER="${PREFIX}a${NUM}"
29+
elif [[ $TYPE == "beta" ]]; then
30+
PYVER="${PREFIX}b${NUM}"
31+
elif [[ $TYPE == "rc" ]]; then
32+
PYVER="${PREFIX}rc${NUM}"
33+
else
34+
# Handle other prerelease designations as dev releases
35+
PYVER="${PREFIX}.dev${NUM}"
36+
fi
37+
else
38+
# If it's a simple version like 1.2.3, use as-is
39+
PYVER="$NPMVER"
40+
fi
41+
echo "version=$PYVER" >> $GITHUB_OUTPUT
42+

.github/workflows/api_clients_ci.yml

-125
This file was deleted.

.github/workflows/ci_cd.yml

+39-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ jobs:
1515
outputs:
1616
# The packages that use Uniffi bindings
1717
ffi_packages: ${{ steps.set_ffi_packages.outputs.ffi_packages }}
18+
# The API client packages
19+
api_packages: ${{ steps.set_api_packages.outputs.api_packages }}
1820
steps:
1921
- id: set_ffi_packages
2022
run: echo 'ffi_packages=["algokit_transact"]' >> $GITHUB_OUTPUT
23+
- id: set_api_packages
24+
run: echo 'api_packages=["algod_api"]' >> $GITHUB_OUTPUT
2125

2226
typescript_wasm_ci_cd:
23-
concurrency: ${{ github.event_name == 'push' && format('cd-{0}', github.ref) || format('ci-typescript_wasm-{0}', github.run_id) }}
2427
needs: setup
2528
uses: ./.github/workflows/typescript_wasm_ci_cd.yml
2629
strategy:
@@ -32,10 +35,12 @@ jobs:
3235
secrets:
3336
BOT_ID: ${{ secrets.BOT_ID }}
3437
BOT_SK: ${{ secrets.BOT_SK }}
38+
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This is used because the GitHub NPM package registry doesn't support GitHub App tokens
3539

3640
python_uniffi_ci_cd:
37-
concurrency: ${{ github.event_name == 'push' && format('cd-{0}', github.ref) || format('ci-python_uniffi-{0}', github.run_id) }}
38-
needs: setup
41+
needs:
42+
- setup
43+
- typescript_wasm_ci_cd
3944
uses: ./.github/workflows/python_uniffi_ci_cd.yml
4045
strategy:
4146
matrix:
@@ -46,3 +51,34 @@ jobs:
4651
secrets:
4752
BOT_ID: ${{ secrets.BOT_ID }}
4853
BOT_SK: ${{ secrets.BOT_SK }}
54+
55+
typescript_api_ci_cd:
56+
needs:
57+
- setup
58+
- python_uniffi_ci_cd
59+
uses: ./.github/workflows/typescript_api_client_ci_cd.yml
60+
strategy:
61+
matrix:
62+
api: ${{ fromJSON(needs.setup.outputs.api_packages) }}
63+
with:
64+
api: ${{ matrix.api }}
65+
release: ${{ github.event_name == 'push' }}
66+
secrets:
67+
BOT_ID: ${{ secrets.BOT_ID }}
68+
BOT_SK: ${{ secrets.BOT_SK }}
69+
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This is used because the GitHub NPM package registry doesn't support GitHub App tokens
70+
71+
python_api_ci_cd:
72+
needs:
73+
- setup
74+
- typescript_api_ci_cd
75+
uses: ./.github/workflows/python_api_client_ci_cd.yml
76+
strategy:
77+
matrix:
78+
api: ${{ fromJSON(needs.setup.outputs.api_packages) }}
79+
with:
80+
api: ${{ matrix.api }}
81+
release: ${{ github.event_name == 'push' }}
82+
secrets:
83+
BOT_ID: ${{ secrets.BOT_ID }}
84+
BOT_SK: ${{ secrets.BOT_SK }}

0 commit comments

Comments
 (0)