Skip to content

Commit ec7e21d

Browse files
Merge pull request #322 from PolicyEngine/publish-clients
Add client publish
2 parents 63e44be + 209f4e8 commit ec7e21d

File tree

3 files changed

+63
-50
lines changed

3 files changed

+63
-50
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,3 @@ jobs:
3939
with:
4040
environment: prod
4141
secrets: inherit
42-
43-
publish_clients:
44-
name: Publish API clients
45-
needs: [deploy_prod]
46-
uses: ./.github/workflows/publish-clients.reusable.yml
47-
with:
48-
environment: prod
49-
secrets:
50-
PYPI_TOKEN: ${{ secrets.PYPI }}

.github/workflows/publish-clients.reusable.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish API clients
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Deploy"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
12+
jobs:
13+
publish:
14+
name: Publish API clients
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.13'
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v3
28+
29+
- name: Generate API clients
30+
run: |
31+
./scripts/generate-clients.sh
32+
33+
- name: Build full API client
34+
run: |
35+
cd projects/policyengine-api-full/artifacts/clients/python
36+
# Update version
37+
DATE=$(date +%Y%m%d)
38+
RUN_NUMBER="${{ github.run_number }}"
39+
NEW_VERSION="0.${DATE}.${RUN_NUMBER}"
40+
sed -i "s/^version = .*/version = \"${NEW_VERSION}\"/" pyproject.toml
41+
uv build
42+
43+
- name: Build simulation API client
44+
run: |
45+
cd projects/policyengine-api-simulation/artifacts/clients/python
46+
# Update version
47+
DATE=$(date +%Y%m%d)
48+
RUN_NUMBER="${{ github.run_number }}"
49+
NEW_VERSION="0.${DATE}.${RUN_NUMBER}"
50+
sed -i "s/^version = .*/version = \"${NEW_VERSION}\"/" pyproject.toml
51+
uv build
52+
53+
- name: Publish full API client to PyPI
54+
uses: pypa/gh-action-pypi-publish@release/v1
55+
with:
56+
password: ${{ secrets.PYPI }}
57+
packages-dir: projects/policyengine-api-full/artifacts/clients/python/dist/
58+
59+
- name: Publish simulation API client to PyPI
60+
uses: pypa/gh-action-pypi-publish@release/v1
61+
with:
62+
password: ${{ secrets.PYPI }}
63+
packages-dir: projects/policyengine-api-simulation/artifacts/clients/python/dist/

0 commit comments

Comments
 (0)