Skip to content

Commit 6ffbaf0

Browse files
AlvinStanescuclaude
andcommitted
ci+hooks: install @uipath/* from public npm via scope override
The smoke pipelines wrote a `~/.npmrc` mapping `@uipath` to GitHub Packages and installed `@latest`. That feed publishes `1.0.0-alpha.YYYYMMDD.*` prereleases under the same dist-tag, so CI was silently picking up alpha builds rather than the public stable line (`@uipath/cli@0.9.0`, `@uipath/rpa-tool@0.9.0`, `@uipath/rpa-legacy-tool@0.9.0`). Switch all installs to public npm `@latest` and force the scope with `--@UiPath:registry=https://registry.npmjs.org/`. Plain `--registry=` does NOT bypass scope mappings — only the scope-specific override does. `hooks/ensure-uip.sh` gets the same flag so a user-side `~/.npmrc` scope mapping can't silently redirect the SessionStart install. The rpa-tool install also moves from `uip tools install` (which inherits the user's npm config) to `npm install -g` with the override, matching what CI does — `npm install -g` lands tools under `<npm-prefix>/@uipath/` where uipcli's ToolManager discovers them. The repo secret `GH_NPM_REGISTRY_TOKEN` is now unused; can be deleted from repo settings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 78deaec commit 6ffbaf0

3 files changed

Lines changed: 35 additions & 56 deletions

File tree

.github/workflows/smoke-rpa-skills.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,23 @@ jobs:
107107
--password "${{ secrets.UV_INDEX_UIPATH_PASSWORD }}" \
108108
--store-password-in-clear-text
109109
110-
# All @uipath/* npm packages come from GitHub Packages, not
111-
# public npm. Configure the registry globally so `npm install -g`
112-
# and uipcli's own `uip tools install` auto-install both route
113-
# through GH Packages.
114-
- name: Configure npm for GitHub Packages (@uipath)
115-
shell: bash
116-
env:
117-
GH_NPM_REGISTRY_TOKEN: ${{ secrets.GH_NPM_REGISTRY_TOKEN }}
118-
run: |
119-
cat > ~/.npmrc <<NPMRC
120-
@uipath:registry=https://npm.pkg.github.com
121-
//npm.pkg.github.com/:_authToken=$GH_NPM_REGISTRY_TOKEN
122-
NPMRC
123-
124-
# Install the CLI + RPA tools from GitHub Packages at the
125-
# `latest` dist-tag. Each package follows its own version line
126-
# (cli → 1.0.x, rpa-tool → 0.9.x, rpa-legacy-tool → 1.0.x), so
127-
# `@latest` is simpler and more resilient than pinning a
128-
# specific major.minor. `npm install -g` lands everything under
129-
# `<npm-global-prefix>/@uipath/` — exactly where uipcli's
130-
# ToolManager walks up to discover tools — so `uip rpa …` /
131-
# `uip rpa-legacy …` work without triggering auto-install.
132-
- name: Install uip CLI + RPA tools from GitHub Packages
110+
# Install from public npm at @latest. The `--@uipath:registry=`
111+
# flag forces the @uipath scope to public npm even if some
112+
# `.npmrc` (runner image, user-level, or future setup-node config)
113+
# maps it elsewhere — notably the internal GitHub Packages feed,
114+
# which carries divergent 1.0.0-alpha.* prereleases under the
115+
# same scope. Plain `--registry=` does NOT bypass scope mappings;
116+
# only the scope-specific override does. `npm install -g` lands
117+
# under `<npm-prefix>/@uipath/`, where uipcli's ToolManager
118+
# discovers tools, so `uip rpa …` / `uip rpa-legacy …` resolve
119+
# without triggering auto-install.
120+
- name: Install uip CLI + RPA tools (public npm @latest)
133121
shell: bash
134122
run: |
135123
set -e
136-
npm install -g @uipath/cli@latest @uipath/rpa-tool@latest @uipath/rpa-legacy-tool@latest
124+
npm install -g \
125+
--@uipath:registry=https://registry.npmjs.org/ \
126+
@uipath/cli@latest @uipath/rpa-tool@latest @uipath/rpa-legacy-tool@latest
137127
uip --version
138128
uip tools list --output json
139129

.github/workflows/smoke-skills.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,16 @@ jobs:
178178
UV_EXTRA_INDEX_URL: "https://${{ secrets.UV_INDEX_UIPATH_USERNAME }}:${{ secrets.UV_INDEX_UIPATH_PASSWORD }}@uipath.pkgs.visualstudio.com/_packaging/ml-packages/pypi/simple/"
179179
run: uv pip install --system .
180180

181-
# All @uipath/* npm packages come from GitHub Packages (where the
182-
# UiPath CLI line is published), not public npm.
183-
- name: Configure npm for GitHub Packages (@uipath)
184-
env:
185-
GH_NPM_REGISTRY_TOKEN: ${{ secrets.GH_NPM_REGISTRY_TOKEN }}
186-
run: |
187-
cat > ~/.npmrc <<NPMRC
188-
@uipath:registry=https://npm.pkg.github.com
189-
//npm.pkg.github.com/:_authToken=$GH_NPM_REGISTRY_TOKEN
190-
NPMRC
191-
192-
- name: Install uip CLI from GitHub Packages
181+
# Install from public npm at @latest. `--@uipath:registry=`
182+
# forces the @uipath scope to public npm regardless of any
183+
# `.npmrc` scope mapping (e.g., to the internal GitHub Packages
184+
# feed, which carries divergent 1.0.0-alpha.* prereleases). See
185+
# smoke-rpa-skills.yml for the full rationale.
186+
- name: Install uip CLI (public npm @latest)
193187
run: |
194-
npm install -g @uipath/cli@latest
188+
npm install -g \
189+
--@uipath:registry=https://registry.npmjs.org/ \
190+
@uipath/cli@latest
195191
uip --version
196192
197193
# Pre-auth uip via the CLI's documented env-var bypass so non-RPA

hooks/ensure-uip.sh

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,41 +65,34 @@ ensure_npm() {
6565
fi
6666
}
6767

68+
# Force the `@uipath` scope to public npm. If a user's `~/.npmrc` maps
69+
# `@uipath` to GitHub Packages (the internal feed), `latest` resolves
70+
# to a `1.0.0-alpha.*` prerelease instead of the public stable line.
71+
# `--registry=` does NOT bypass scope mappings — only the scope-specific
72+
# override does. Apply to `outdated` (registry lookup) and `install`;
73+
# `ls` reads disk and doesn't need it.
74+
UIPATH_REGISTRY_FLAG="--@uipath:registry=https://registry.npmjs.org/"
75+
6876
# npm install -g always re-downloads and re-installs, even if the same version
6977
# is already present. This is slow for a synchronous session hook and also
7078
# re-triggers package lifecycle scripts. Check first, install only when needed.
7179
ensure_npm_package() {
7280
local pkg="$1"
7381

7482
if npm ls -g "$pkg" --depth=0 &>/dev/null \
75-
&& [ -z "$(npm outdated -g "$pkg" 2>/dev/null)" ]; then
83+
&& [ -z "$(npm outdated -g "$pkg" $UIPATH_REGISTRY_FLAG 2>/dev/null)" ]; then
7684
echo "$pkg is already installed and up to date." >&2
7785
return
7886
fi
7987

8088
echo "Installing or updating $pkg globally..." >&2
81-
if ! npm install -g "$pkg" 2>&1; then
82-
echo "Failed to install $pkg. Please run: npm install -g $pkg" >&2
83-
exit 2
84-
fi
85-
}
86-
87-
ensure_uip_tool() {
88-
local pkg="$1"
89-
echo "Installing or updating uip tool ($pkg)..." >&2
90-
91-
local output
92-
output="$(uip tools install "$pkg" 2>&1)"
93-
94-
if echo "$output" | grep -qi "error"; then
95-
echo "Failed to install uip tool $pkg:" >&2
96-
echo "$output" >&2
97-
echo "Please run manually: uip tools install $pkg" >&2
89+
if ! npm install -g $UIPATH_REGISTRY_FLAG "$pkg" 2>&1; then
90+
echo "Failed to install $pkg. Please run: npm install -g $UIPATH_REGISTRY_FLAG $pkg" >&2
9891
exit 2
9992
fi
10093
}
10194

10295
# ── main ─────────────────────────────────────────────────────────────
10396
ensure_npm
10497
ensure_npm_package @uipath/cli
105-
ensure_uip_tool @uipath/rpa-tool
98+
ensure_npm_package @uipath/rpa-tool

0 commit comments

Comments
 (0)