Skip to content

Commit 0b1fc21

Browse files
Merge pull request #98 from UiPath/chore/refactor-ci
chore: refactor GitHub Actions workflow for build and publish process
2 parents d373cc6 + 9bfb665 commit 0b1fc21

File tree

1 file changed

+49
-19
lines changed

1 file changed

+49
-19
lines changed

.github/workflows/publish.yml

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,67 @@
1-
name: Build and publish
1+
name: CD
22

33
on:
4-
workflow_dispatch: {}
4+
workflow_dispatch:
55
push:
66
branches:
77
- main
8+
paths:
9+
- pyproject.toml
810

911
jobs:
10-
build-and-publish:
11-
name: Build and publish
12-
runs-on: "ubuntu-24.04"
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
16+
17+
if: ${{ github.repository == 'UiPath/uipath-mcp-python' }}
18+
permissions:
19+
contents: read
20+
actions: write
1321

1422
steps:
15-
- uses: actions/checkout@v4
23+
- name: Checkout
24+
uses: actions/checkout@v4
1625

17-
- uses: astral-sh/setup-uv@v5
26+
- name: Setup uv
27+
uses: astral-sh/setup-uv@v5
28+
with:
29+
enable-cache: true
1830

19-
- uses: actions/setup-python@v5
31+
- name: Setup Python
32+
uses: actions/setup-python@v5
2033
with:
2134
python-version-file: ".python-version"
2235

23-
- name: Setup venv
24-
run: |
25-
uv venv
26-
uv sync --all-extras
36+
- name: Install dependencies
37+
run: uv sync --all-extras
2738

2839
- name: Build
29-
run: |
30-
uv build
40+
run: uv build
41+
42+
- name: Upload artifacts
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: release-dists
46+
path: dist/
3147

32-
- name: Publish
33-
run: |
34-
uv publish
35-
env:
36-
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
48+
pypi-publish:
49+
name: Upload release to PyPI
50+
runs-on: ubuntu-latest
51+
environment: pypi
52+
53+
needs:
54+
- build
55+
permissions:
56+
contents: read
57+
id-token: write
58+
59+
steps:
60+
- name: Retrieve release distributions
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: release-dists
64+
path: dist/
3765

66+
- name: Publish package distributions to PyPI
67+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)