Skip to content

Commit c7df7b9

Browse files
feat(codedapp-tool): add CI publish workflow and fix public registry config
- Switch publishConfig from GitHub Packages to public npm registry - Add CI workflow to auto-publish on merge to main - Install @uipath/auth from public npm for bundling (not as a dependency) - Bump version to 0.1.6 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4f5c8ac commit c7df7b9

File tree

2 files changed

+118
-2
lines changed

2 files changed

+118
-2
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Publish codedapp-tool
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'packages/codedapp-tool/**'
8+
- 'packages/cli/src/actions/**'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
id-token: write
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
environment: production
20+
defaults:
21+
run:
22+
working-directory: packages/codedapp-tool
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '24'
33+
34+
- name: Setup Bun
35+
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
36+
37+
- name: Check if version already published
38+
id: version-check
39+
run: |
40+
PACKAGE_NAME=$(node -p "require('./package.json').name")
41+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
42+
echo "name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
43+
echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
44+
45+
# Check if this exact version exists on npm
46+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/${PACKAGE_NAME}/${PACKAGE_VERSION}")
47+
if [ "$HTTP_STATUS" = "200" ]; then
48+
echo "already_published=true" >> $GITHUB_OUTPUT
49+
echo "Version $PACKAGE_VERSION is already published — skipping."
50+
else
51+
echo "already_published=false" >> $GITHUB_OUTPUT
52+
echo "Version $PACKAGE_VERSION not found on npm — will publish."
53+
fi
54+
55+
- name: Install dependencies
56+
if: steps.version-check.outputs.already_published == 'false'
57+
run: npm ci
58+
working-directory: .
59+
60+
- name: Install @uipath/auth for bundling
61+
if: steps.version-check.outputs.already_published == 'false'
62+
run: npm install --no-save @uipath/auth --registry=https://registry.npmjs.org
63+
64+
- name: Build CLI dependency
65+
if: steps.version-check.outputs.already_published == 'false'
66+
run: npm run build
67+
working-directory: packages/cli
68+
69+
- name: Build codedapp-tool
70+
if: steps.version-check.outputs.already_published == 'false'
71+
run: npm run build
72+
73+
- name: Run tests
74+
if: steps.version-check.outputs.already_published == 'false'
75+
run: npm test
76+
77+
- name: Setup registry for npm
78+
if: steps.version-check.outputs.already_published == 'false'
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: '24'
82+
registry-url: 'https://registry.npmjs.org'
83+
84+
- name: Publish to npm
85+
if: steps.version-check.outputs.already_published == 'false'
86+
run: |
87+
echo "@uipath:registry=https://registry.npmjs.org" > .npmrc
88+
npm publish --provenance --access public
89+
90+
- name: Publish to GitHub Packages
91+
if: steps.version-check.outputs.already_published == 'false'
92+
run: |
93+
echo "@uipath:registry=https://npm.pkg.github.com" > .npmrc
94+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
95+
npm publish
96+
env:
97+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
99+
- name: Generate Summary
100+
run: |
101+
VERSION=${{ steps.version-check.outputs.version }}
102+
PUBLISHED=${{ steps.version-check.outputs.already_published }}
103+
echo "## codedapp-tool publish" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
if [ "$PUBLISHED" = "true" ]; then
106+
echo "**Version $VERSION** is already published — no action taken." >> $GITHUB_STEP_SUMMARY
107+
else
108+
echo "**Version $VERSION** published successfully." >> $GITHUB_STEP_SUMMARY
109+
echo "" >> $GITHUB_STEP_SUMMARY
110+
echo "### Package Details:" >> $GITHUB_STEP_SUMMARY
111+
echo "- **Package:** \`@uipath/codedapp-tool\`" >> $GITHUB_STEP_SUMMARY
112+
echo "- **Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
113+
echo "- Published to npm registry (public access, with provenance)" >> $GITHUB_STEP_SUMMARY
114+
echo "- Published to GitHub Packages" >> $GITHUB_STEP_SUMMARY
115+
fi

packages/codedapp-tool/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uipath/codedapp-tool",
3-
"version": "0.1.0",
3+
"version": "0.1.6",
44
"description": "uipcli plugin for coded web applications",
55
"keywords": ["uipcli-tool"],
66
"type": "module",
@@ -41,7 +41,8 @@
4141
"directory": "packages/codedapp-tool"
4242
},
4343
"publishConfig": {
44-
"registry": "https://npm.pkg.github.com"
44+
"registry": "https://registry.npmjs.org",
45+
"access": "public"
4546
},
4647
"engines": {
4748
"node": ">=18.0.0"

0 commit comments

Comments
 (0)