Skip to content

Commit e80ff4a

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 e80ff4a

2 files changed

Lines changed: 113 additions & 2 deletions

File tree

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