Skip to content

Commit 3a9d744

Browse files
chore: test
1 parent 3d5dd13 commit 3a9d744

File tree

1 file changed

+17
-85
lines changed

1 file changed

+17
-85
lines changed

.github/workflows/publish.yml

Lines changed: 17 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
pull_request:
88
branches:
99
- main
10+
types:
11+
- opened
12+
- reopened
13+
- synchronize
1014
workflow_dispatch:
1115

1216
concurrency: ${{ github.workflow }}-${{ github.ref }}
@@ -22,73 +26,8 @@ permissions:
2226
contents: read
2327

2428
jobs:
25-
build:
26-
name: Build & Verify
27-
runs-on: ubuntu-latest
28-
steps:
29-
- name: 🛎️ Checkout Repo
30-
uses: actions/checkout@v4
31-
with:
32-
fetch-depth: 0
33-
34-
- name: 🤐 Disable Husky
35-
run: echo "HUSKY=0" >> $GITHUB_ENV
36-
37-
- name: 📦 Setup pnpm
38-
uses: pnpm/action-setup@v4
39-
with:
40-
version: 8
41-
42-
- name: 🔧 Setup Node.js
43-
uses: actions/setup-node@v4
44-
with:
45-
node-version: "lts/*"
46-
registry-url: "https://registry.npmjs.org"
47-
cache: "pnpm"
48-
49-
- name: 📦 Update npm to support Trusted Publishers
50-
run: npm install -g npm@11.5.1
51-
52-
- name: 🔧 Install dependencies
53-
run: pnpm install
54-
55-
- name: ❌ Disable pnpm git-checks
56-
run: pnpm config set git-checks false
57-
58-
- name: 📄 Copy README to child CLIs
59-
if: github.event_name == 'pull_request'
60-
run: |
61-
for pkg in create-pg create-postgres; do
62-
cp create-db/README.md "$pkg/README.md"
63-
done
64-
65-
- name: 🔨 Build packages
66-
run: |
67-
for pkg in ${{ env.WORKSPACES }}; do
68-
if [ -f "$pkg/package.json" ]; then
69-
cd "$pkg"
70-
if grep -q '"build"' package.json; then
71-
echo "Building $pkg..."
72-
pnpm run build || echo "Build skipped for $pkg (no build script)"
73-
fi
74-
cd - >/dev/null
75-
fi
76-
done
77-
78-
- name: ✅ Verify package integrity
79-
run: |
80-
for pkg in ${{ env.WORKSPACES }}; do
81-
if [ -f "$pkg/package.json" ]; then
82-
cd "$pkg"
83-
echo "Verifying $pkg..."
84-
pnpm pack --dry-run
85-
cd - >/dev/null
86-
fi
87-
done
88-
8929
release:
9030
name: 🚀 Release CLIs
91-
needs: build
9231
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
9332
runs-on: ubuntu-latest
9433
permissions:
@@ -168,9 +107,8 @@ jobs:
168107
env:
169108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170109

171-
experimental-release:
172-
name: 🚧 Preview Release
173-
needs: build
110+
preview:
111+
name: 🚧 Preview release (PR #${{ github.event.number }})
174112
if: github.event_name == 'pull_request'
175113
runs-on: ubuntu-latest
176114
permissions:
@@ -216,19 +154,6 @@ jobs:
216154
SAFE_REF=$(echo "${{ github.event.pull_request.head.ref }}" | tr '/' '-')
217155
echo "PRE_TAG=pr${{ github.event.number }}-${SAFE_REF}-${{ github.run_id }}" >> $GITHUB_ENV
218156
219-
- name: 🔨 Build packages
220-
run: |
221-
for pkg in ${{ env.WORKSPACES }}; do
222-
if [ -f "$pkg/package.json" ]; then
223-
cd "$pkg"
224-
if grep -q '"build"' package.json; then
225-
echo "Building $pkg..."
226-
pnpm run build || echo "Build skipped for $pkg (no build script)"
227-
fi
228-
cd - >/dev/null
229-
fi
230-
done
231-
232157
- name: 🚀 Bump & publish CLI previews
233158
env:
234159
PRE_TAG: ${{ env.PRE_TAG }}
@@ -237,8 +162,16 @@ jobs:
237162
POSTHOG_API_HOST: ${{ secrets.POSTHOG_API_HOST }}
238163
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
239164
run: |
240-
echo "Using CREATE_DB_WORKER_URL=${CREATE_DB_WORKER_URL}"
241-
echo "Using CLAIM_DB_WORKER_URL=${CLAIM_DB_WORKER_URL}"
165+
# Resolve URLs with fallback
166+
CREATE_DB_WORKER_URL="${{ secrets.CREATE_DB_WORKER_URL }}"
167+
CLAIM_DB_WORKER_URL="${{ secrets.CLAIM_DB_WORKER_URL }}"
168+
169+
# Persist for next steps
170+
echo "CREATE_DB_WORKER_URL=$CREATE_DB_WORKER_URL" >> $GITHUB_ENV
171+
echo "CLAIM_DB_WORKER_URL=$CLAIM_DB_WORKER_URL" >> $GITHUB_ENV
172+
173+
echo "Using CREATE_DB_WORKER_URL=$CREATE_DB_WORKER_URL"
174+
echo "Using CLAIM_DB_WORKER_URL=$CLAIM_DB_WORKER_URL"
242175
echo "Using POSTHOG_API_HOST=${POSTHOG_API_HOST}"
243176
244177
for pkg in ${{ env.WORKSPACES }}; do
@@ -249,9 +182,8 @@ jobs:
249182
export POSTHOG_API_KEY="${POSTHOG_API_KEY}"
250183
251184
npm version prerelease \
252-
--preid "${PRE_TAG}" \
185+
--preid "$PRE_TAG" \
253186
--no-git-tag-version
254-
255187
pnpm publish --access public --tag pr${{ github.event.number }} --no-git-checks
256188
cd - >/dev/null
257189
done

0 commit comments

Comments
 (0)