Skip to content

Commit a2cd007

Browse files
feat(codedapp-tool): add CI publish workflow and fix public registry config
- Add publish-codedapp-tool.yml workflow that auto-publishes to both npmjs.org and GitHub Packages on merge to main - Version check prevents re-publishing existing versions - Pin oven-sh/setup-bun to full commit SHA for security - Switch publishConfig from GitHub Packages to npmjs.org (public) - Bump version to 0.1.6 to match CLI major.minor for auto-install Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4f5c8ac commit a2cd007

2 files changed

Lines changed: 114 additions & 2 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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: Build CLI dependency
61+
if: steps.version-check.outputs.already_published == 'false'
62+
run: npm run build
63+
working-directory: packages/cli
64+
65+
- name: Build codedapp-tool
66+
if: steps.version-check.outputs.already_published == 'false'
67+
run: npm run build
68+
69+
- name: Run tests
70+
if: steps.version-check.outputs.already_published == 'false'
71+
run: npm test
72+
73+
- name: Setup registry for npm
74+
if: steps.version-check.outputs.already_published == 'false'
75+
uses: actions/setup-node@v4
76+
with:
77+
node-version: '24'
78+
registry-url: 'https://registry.npmjs.org'
79+
80+
- name: Publish to npm
81+
if: steps.version-check.outputs.already_published == 'false'
82+
run: |
83+
echo "@uipath:registry=https://registry.npmjs.org" > .npmrc
84+
npm publish --provenance --access public
85+
86+
- name: Publish to GitHub Packages
87+
if: steps.version-check.outputs.already_published == 'false'
88+
run: |
89+
echo "@uipath:registry=https://npm.pkg.github.com" > .npmrc
90+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
91+
npm publish
92+
env:
93+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
95+
- name: Generate Summary
96+
run: |
97+
VERSION=${{ steps.version-check.outputs.version }}
98+
PUBLISHED=${{ steps.version-check.outputs.already_published }}
99+
echo "## codedapp-tool publish" >> $GITHUB_STEP_SUMMARY
100+
echo "" >> $GITHUB_STEP_SUMMARY
101+
if [ "$PUBLISHED" = "true" ]; then
102+
echo "**Version $VERSION** is already published — no action taken." >> $GITHUB_STEP_SUMMARY
103+
else
104+
echo "**Version $VERSION** published successfully." >> $GITHUB_STEP_SUMMARY
105+
echo "" >> $GITHUB_STEP_SUMMARY
106+
echo "### Package Details:" >> $GITHUB_STEP_SUMMARY
107+
echo "- **Package:** \`@uipath/codedapp-tool\`" >> $GITHUB_STEP_SUMMARY
108+
echo "- **Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
109+
echo "- Published to npm registry (public access, with provenance)" >> $GITHUB_STEP_SUMMARY
110+
echo "- Published to GitHub Packages" >> $GITHUB_STEP_SUMMARY
111+
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)