Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,28 @@ jobs:
echo "Using CLAIM_DB_WORKER_URL=$CLAIM_DB_WORKER_URL"
echo "Using POSTHOG_API_HOST=${POSTHOG_API_HOST}"

for pkg in $WORKSPACES; do
# First, update create-db version and publish it
cd create-db
npm version prerelease --preid "$PRE_TAG" --no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version")
pnpm publish --access public --tag pr${{ github.event.number }} --no-git-checks
cd ..

# Then update create-pg and create-postgres to use the new create-db version
for pkg in create-pg create-postgres; do
cd "$pkg"
export CREATE_DB_WORKER_URL
export CLAIM_DB_WORKER_URL
export POSTHOG_API_HOST="${POSTHOG_API_HOST}"
export POSTHOG_API_KEY="${POSTHOG_API_KEY}"


# Update dependency to use the published version instead of workspace:*
npm pkg set dependencies.create-db="$NEW_VERSION"

npm version prerelease \
--preid "$PRE_TAG" \
--no-git-tag-version
pnpm publish --access public --tag pr${{ github.event.number }}
pnpm publish --access public --tag pr${{ github.event.number }} --no-git-checks
cd - >/dev/null
done

Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,34 @@ jobs:
echo "Using CLAIM_DB_WORKER_URL=${CLAIM_DB_WORKER_URL}"
echo "Using POSTHOG_API_HOST=${POSTHOG_API_HOST}"

for pkg in $WORKSPACES; do
# First, publish create-db
echo "Publishing create-db to npm..."
cd create-db
export POSTHOG_API_HOST="${{ secrets.POSTHOG_API_HOST }}"
export POSTHOG_API_KEY="${{ secrets.POSTHOG_API_KEY }}"
CREATE_DB_VERSION=$(node -p "require('./package.json').version")
if ! pnpm publish --access public --no-git-checks; then
echo "Publish failed, trying to bump version and retry..."
npm version patch --no-git-tag-version
CREATE_DB_VERSION=$(node -p "require('./package.json').version")
pnpm publish --access public --no-git-checks || echo "Publish failed again for create-db"
fi
cd ..

# Then publish create-pg and create-postgres with resolved dependencies
for pkg in create-pg create-postgres; do
echo "Publishing $pkg to npm..."
cd "$pkg"
export POSTHOG_API_HOST="${{ secrets.POSTHOG_API_HOST }}"
export POSTHOG_API_KEY="${{ secrets.POSTHOG_API_KEY }}"
# pnpm publish --access public || echo "Publish failed for $pkg"
# First try to publish
if ! pnpm publish --access public; then

# Update dependency to use the published version instead of workspace:*
npm pkg set dependencies.create-db="$CREATE_DB_VERSION"

if ! pnpm publish --access public --no-git-checks; then
echo "Publish failed, trying to bump version and retry..."
npm version patch --no-git-tag-version
pnpm publish --access public || echo "Publish failed again for $pkg"
pnpm publish --access public --no-git-checks || echo "Publish failed again for $pkg"
fi
cd - >/dev/null
done
Expand Down
2 changes: 1 addition & 1 deletion create-db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ async function createDatabase(name, region, userAgent, silent = false) {
});
}

async function main() {
export async function main() {
try {
const rawArgs = process.argv.slice(2);

Expand Down