1- # This workflow will upload a Python Package using Twine when a release is created
2- # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4- name : Upload Python Package
5-
1+ name : Release
62on :
7- release :
8- types : [published]
3+ push :
4+ branches :
5+ - main
6+ - pre/*
97
108jobs :
11- deploy :
12-
9+ build :
10+ name : Build
1311 runs-on : ubuntu-latest
12+ steps :
13+ - name : Install git
14+ run : |
15+ sudo apt update
16+ sudo apt install -y git
17+ - name : Install uv
18+ uses : astral-sh/setup-uv@v3
19+ - name : Install Node Env
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : 20
23+ - name : Checkout
24+ 25+ with :
26+ fetch-depth : 0
27+ persist-credentials : false
28+ - name : Build app
29+ run : |
30+ cd scrapegraph-py
31+ uv sync --frozen
32+ uv build
33+ id : build_cache
34+ if : success()
35+ - name : Cache build
36+ uses : actions/cache@v4
37+ with :
38+ path : scrapegraph-py/dist
39+ key : ${{ runner.os }}-build-${{ hashFiles('scrapegraph-py/dist/**') }}
40+ if : steps.build_cache.outputs.id != ''
1441
42+ release :
43+ name : Release
44+ runs-on : ubuntu-latest
45+ needs : build
46+ environment : development
47+ if : |
48+ github.event_name == 'push' && github.ref == 'refs/heads/main' ||
49+ github.event_name == 'push' && github.ref == 'refs/heads/pre/beta' ||
50+ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'main' ||
51+ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'pre/beta'
52+ permissions :
53+ contents : write
54+ issues : write
55+ pull-requests : write
56+ id-token : write
1557 steps :
16- - uses : actions/checkout@v4
17- - name : Set up Python
18- uses : actions/setup-python@v5
19- with :
20- python-version : ' 3.x'
21- - name : Install dependencies
22- run : |
23- python -m pip install --upgrade pip
24- pip install setuptools wheel twine
25- - name : Build and publish
26- env :
27- TWINE_USERNAME : mvincig11
28- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
29- run : |
30- git fetch --all --tags
31- python setup.py sdist bdist_wheel
32- twine upload dist/*
58+ - name : Checkout repo
59+ 60+ with :
61+ fetch-depth : 0
62+ persist-credentials : false
63+ - name : Install uv
64+ uses : astral-sh/setup-uv@v3
65+ - name : Setup Python environment
66+ run : |
67+ cd ./scrapegraph-py
68+ uv sync
69+ - name : Restore build artifacts
70+ uses : actions/cache@v4
71+ with :
72+ path : ./scrapegraph-py/dist
73+ key : ${{ runner.os }}-build-${{ hashFiles('./scrapegraph-py/dist/**') }}
74+ - name : Semantic Release
75+ 76+ env :
77+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
79+ with :
80+ working_directory : ./scrapegraph-py
81+ semantic_version : 23
82+ extra_plugins : |
83+ semantic-release-pypi@3
84+ @semantic-release/git
85+ @semantic-release/commit-analyzer@12
86+ @semantic-release/release-notes-generator@13
87+ @semantic-release/github@10
88+ @semantic-release/changelog@6
89+ conventional-changelog-conventionalcommits@7
0 commit comments