diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b7c5ff66c2..0845ab9008 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -548,3 +548,47 @@ jobs: steps: - if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }} run: exit 1 + + publish-canary: + name: Publish Canary + if: | + github.ref == 'refs/heads/beta' && + github.repository == 'payloadcms/payload' + runs-on: ubuntu-latest + needs: + - all-green + + steps: + # https://github.com/actions/virtual-environments/issues/1187 + - name: tune linux network + run: sudo ethtool -K eth0 tx off rx off + + - name: Setup Node@${{ env.NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: ${{ env.PNPM_VERSION }} + run_install: false + + - name: Restore build + uses: actions/cache@v4 + timeout-minutes: 10 + with: + path: ./* + key: ${{ github.sha }}-${{ github.run_number }} + + - name: Load npm token + run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Canary release script + # dry run hard-coded to true for testing and no npm token provided + run: pnpm tsx ./scripts/publish-canary.ts + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true diff --git a/scripts/publish-canary.ts b/scripts/publish-canary.ts index f4efc9c9f2..2dd13e6436 100755 --- a/scripts/publish-canary.ts +++ b/scripts/publish-canary.ts @@ -2,24 +2,12 @@ import type { ExecSyncOptions } from 'child_process' import type execa from 'execa' import chalk from 'chalk' -import { loadChangelogConfig } from 'changelogen' -import { execSync } from 'child_process' -import fse from 'fs-extra' import minimist from 'minimist' import { fileURLToPath } from 'node:url' import pLimit from 'p-limit' import path from 'path' -import prompts from 'prompts' -import semver from 'semver' -import type { PackageDetails } from './lib/getPackageDetails.js' - -import { getPackageDetails } from './lib/getPackageDetails.js' -import { getPackageRegistryVersions } from './lib/getPackageRegistryVersions.js' import { getWorkspace } from './lib/getWorkspace.js' -import { packagePublishList } from './lib/publishList.js' -import { getRecommendedBump } from './utils/getRecommendedBump.js' -import { updateChangelog } from './utils/updateChangelog.js' const npmPublishLimit = pLimit(5) @@ -43,8 +31,6 @@ const args = minimist(process.argv.slice(2)) const dryRun = true -const logPrefix = dryRun ? chalk.bold.magenta('[dry-run] >') : '' - async function main() { const workspace = await getWorkspace() await workspace.bumpVersion('canary')