-
Notifications
You must be signed in to change notification settings - Fork 23
121 lines (103 loc) · 3.32 KB
/
cd.yml
File metadata and controls
121 lines (103 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: CD
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'packages/*/pyproject.toml'
- '!packages/*/samples/**/pyproject.toml'
- '!packages/*/testcases/**/pyproject.toml'
permissions:
contents: read
pull-requests: read
jobs:
detect-changed-packages:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.detect.outputs.packages }}
count: ${{ steps.detect.outputs.count }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Detect changed packages
id: detect
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.before }}
HEAD_SHA: ${{ github.event.after }}
run: python .github/scripts/detect_changed_packages.py
build:
name: Build ${{ matrix.package }}
needs: detect-changed-packages
if: needs.detect-changed-packages.outputs.count > 0 && github.repository == 'UiPath/uipath-python'
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/${{ matrix.package }}
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.detect-changed-packages.outputs.packages) }}
permissions:
contents: read
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: "packages/${{ matrix.package }}/.python-version"
- name: Install dependencies
run: uv sync --all-extras
- name: Update AGENTS.md
if: matrix.package == 'uipath'
run: uv run python scripts/update_agents_md.py
- name: Replace connection string placeholder
if: matrix.package == 'uipath'
run: |
originalfile="src/uipath/telemetry/_constants.py"
tmpfile=$(mktemp)
trap 'rm -f "$tmpfile"' EXIT
rsync -a --no-whole-file --ignore-existing "$originalfile" "$tmpfile"
envsubst '$CONNECTION_STRING' < "$originalfile" > "$tmpfile" && mv "$tmpfile" "$originalfile"
env:
CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
- name: Build
run: uv build --no-sources --package ${{ matrix.package }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-dists-${{ matrix.package }}
path: packages/${{ matrix.package }}/dist/
pypi-publish:
name: Upload ${{ matrix.package }} to PyPI
needs: [detect-changed-packages, build]
runs-on: ubuntu-latest
environment: pypi
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.detect-changed-packages.outputs.packages) }}
permissions:
contents: read
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists-${{ matrix.package }}
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1