Skip to content

Commit b0f8f45

Browse files
committed
test publish
1 parent 4032c56 commit b0f8f45

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/test-publish.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Test NPM Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
npm_token:
7+
description: 'NPM Token (optional, will use secrets.NPM_TOKEN if not provided)'
8+
required: false
9+
type: string
10+
dry_run:
11+
description: 'Dry run (no actual publish)'
12+
required: false
13+
default: 'true'
14+
type: choice
15+
options:
16+
- 'true'
17+
- 'false'
18+
19+
jobs:
20+
test-publish:
21+
name: Test NPM Publish
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- uses: pnpm/action-setup@v4
28+
name: Install pnpm
29+
id: pnpm-install
30+
31+
- name: Setup Node.js 20.x
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20.x
35+
cache: "pnpm"
36+
registry-url: "https://registry.npmjs.org"
37+
38+
- name: Install dependencies
39+
run: pnpm install
40+
41+
- name: Debug - Check NPM Configuration
42+
run: |
43+
echo "NPM Registry:"
44+
npm config get registry
45+
46+
echo "NPM Auth Token exists:"
47+
if [ -n "${{ secrets.NPM_TOKEN }}" ]; then
48+
echo "Yes, NPM_TOKEN secret exists"
49+
else
50+
echo "No, NPM_TOKEN secret is missing"
51+
fi
52+
53+
echo "NPM Config File:"
54+
cat ~/.npmrc || echo "No .npmrc file found"
55+
56+
- name: Debug - Check NPM Login Status
57+
env:
58+
NODE_AUTH_TOKEN: ${{ inputs.npm_token || secrets.NPM_TOKEN }}
59+
run: |
60+
echo "Attempting npm whoami..."
61+
npm whoami || echo "Not logged in or token is invalid"
62+
63+
- name: Debug - Check Package Info
64+
run: |
65+
echo "Package info for git-intent:"
66+
npm info git-intent || echo "Package not found or other error"
67+
68+
echo "Package info for @offlegacy/git-intent-core:"
69+
npm info @offlegacy/git-intent-core || echo "Package not found or other error"
70+
71+
- name: Build packages
72+
run: pnpm build
73+
74+
- name: Test Release (Dry Run)
75+
if: inputs.dry_run == 'true'
76+
env:
77+
NODE_AUTH_TOKEN: ${{ inputs.npm_token || secrets.NPM_TOKEN }}
78+
NPM_TOKEN: ${{ inputs.npm_token || secrets.NPM_TOKEN }}
79+
run: |
80+
echo "Running in DRY RUN mode (no actual publish)"
81+
pnpm changeset version --snapshot test
82+
echo "Testing publish with --no-git-tag --dry-run flags"
83+
pnpm changeset publish --no-git-tag --dry-run
84+
85+
- name: Actual Release
86+
if: inputs.dry_run == 'false'
87+
env:
88+
NODE_AUTH_TOKEN: ${{ inputs.npm_token || secrets.NPM_TOKEN }}
89+
NPM_TOKEN: ${{ inputs.npm_token || secrets.NPM_TOKEN }}
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: |
92+
echo "Running ACTUAL PUBLISH (not a dry run)"
93+
pnpm release

0 commit comments

Comments
 (0)