From c92a9a1611a21c3964d4631a579774a467ed44fa Mon Sep 17 00:00:00 2001 From: Jonas Daniels Date: Thu, 12 Dec 2024 21:13:50 -0800 Subject: [PATCH] simplify publish github actions --- .github/workflows/CI.yml | 4 +- .github/workflows/release-nightly.yml | 8 ---- .github/workflows/release.yml | 8 ---- package.json | 3 +- scripts/pre-release.mjs | 55 --------------------------- 5 files changed, 3 insertions(+), 75 deletions(-) delete mode 100644 scripts/pre-release.mjs diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3f03a3bb56a..2dd47e3dcac 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -44,7 +44,7 @@ jobs: uses: ./.github/composite-actions/install - name: Build Packages - run: pnpm build:packages + run: pnpm build lint: needs: optimize_ci @@ -112,7 +112,7 @@ jobs: uses: ./.github/composite-actions/install - name: Build Packages - run: pnpm build:packages + run: pnpm build - name: Install Yarn (if needed) if: matrix.package_manager == 'yarn' diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index c5054e38a0c..751e83df859 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -30,17 +30,9 @@ jobs: # Do not use the GITHUB_TOKEN by default token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} - - name: Setup bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: 1.0.35 - - name: Install uses: ./.github/composite-actions/install - - name: Build - run: pnpm build - - name: Create @nightly release run: | pnpm version-packages:nightly diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2d4dbf1162..37028435f97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,17 +31,9 @@ jobs: # Do not use the GITHUB_TOKEN by default token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} - - name: Setup bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: 1.0.35 - - name: Install uses: ./.github/composite-actions/install - - name: Build - run: pnpm build:release - - name: Create release Pull Request or publish to NPM id: changesets uses: changesets/action@v1 diff --git a/package.json b/package.json index c173ce295b1..55d6f0f9fa2 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,8 @@ "portal:build": "turbo run build --filter=./apps/portal", "dashboard": "turbo run dev --filter=./apps/dashboard --filter=./packages/thirdweb", "dashboard:build": "turbo run build --filter=./apps/dashboard", - "build:packages": "turbo run build --filter=./packages/*", "build": "turbo run build --filter=./packages/*", - "build:release": "pnpm run build --filter=./packages/* --force", + "build:release": "turbo run build --filter=./packages/* --force", "test": "turbo run test --filter=./packages/*", "e2e": "turbo run e2e --filter=./packages/*", "bench": "turbo run bench", diff --git a/scripts/pre-release.mjs b/scripts/pre-release.mjs deleted file mode 100644 index 8c0564e88a4..00000000000 --- a/scripts/pre-release.mjs +++ /dev/null @@ -1,55 +0,0 @@ -import { getPackagesSync } from "@manypkg/get-packages"; -import { writeFileSync } from "fs"; -import { join } from "path"; - -const { packages } = getPackagesSync(process.cwd()); - -// map of package names to their versions and directories -const packageVersions = packages.reduce((acc, pkg) => { - acc[pkg.packageJson.name] = { - version: pkg.packageJson.version, - dir: pkg.dir, - }; - return acc; -}, {}); - -// loop over each package and update its dependencies if they are set to * and in the map -packages.forEach((pkg) => { - const packageJson = pkg.packageJson; - const dependencies = packageJson.dependencies || {}; - const devDependencies = packageJson.devDependencies || {}; - const peerDependencies = packageJson.peerDependencies || {}; - - Object.entries(dependencies).forEach(([dep, version]) => { - if (dep in packageVersions && version === "workspace:*") { - // if it's part of the dependencies directly then ask for the exact version - packageJson.dependencies[dep] = `${packageVersions[dep].version}`; - } - }); - - Object.entries(devDependencies).forEach(([dep, version]) => { - if (dep in packageVersions && version === "workspace:*") { - // if it's part of the devDependencies directly then ask for a version within range - packageJson.devDependencies[dep] = `^${packageVersions[dep].version}`; - } - }); - - Object.entries(peerDependencies).forEach(([dep, version]) => { - if (dep in packageVersions && version === "workspace:*") { - // if it's part of the devDependencies directly then ask for a version within range - packageJson.peerDependencies[dep] = `^${packageVersions[dep].version}`; - } - }); - - if (!process.env.CI) { - console.error( - `Not in CI, skipping writing package.json for: "${pkg.packageJson.name}"`, - ); - return; - } - console.info("writing package.json for: ", pkg.packageJson.name); - writeFileSync( - join(pkg.dir, "package.json"), - JSON.stringify(packageJson, null, 2), - ); -});