Skip to content

Commit 6cc1414

Browse files
Add Github Action for build and publish package (#4)
* Add Github Action for build and publish package * Add twine upload * Use actions/upload-artifact@v4 * Fix * Add missing id-token: write * Fix workflow * Fix
1 parent 64f8448 commit 6cc1414

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy on Production
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
# push:
9+
# tags:
10+
# - v*
11+
12+
jobs:
13+
build:
14+
name: Build Python package
15+
runs-on: ubuntu-latest
16+
environment: release
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
with:
21+
ref: main
22+
23+
- name: Install dependencies
24+
run: |
25+
python3 -m pip install --upgrade pip
26+
pip3 install -r requirements.txt
27+
28+
- name: Build Python wheel
29+
run: |
30+
python3 -m build
31+
32+
- name: Store the distribution packages
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: python-package-distributions
36+
path: dist/
37+
38+
publish-to-pypi:
39+
name: Publish to PyPI
40+
# if: startsWith(github.ref, 'refs/tags/')
41+
needs:
42+
- build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/p/lara-sdk
47+
permissions:
48+
id-token: write
49+
50+
steps:
51+
- name: Download all the dists
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: python-package-distributions
55+
path: dist/
56+
- name: Publish distribution to PyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)