ci: auto release canary on success (#7444)
Automatically release canary on successful workflow.
This commit is contained in:
44
.github/workflows/main.yml
vendored
44
.github/workflows/main.yml
vendored
@@ -548,3 +548,47 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
|
- if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
|
||||||
run: exit 1
|
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
|
||||||
|
|||||||
@@ -2,24 +2,12 @@ import type { ExecSyncOptions } from 'child_process'
|
|||||||
import type execa from 'execa'
|
import type execa from 'execa'
|
||||||
|
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import { loadChangelogConfig } from 'changelogen'
|
|
||||||
import { execSync } from 'child_process'
|
|
||||||
import fse from 'fs-extra'
|
|
||||||
import minimist from 'minimist'
|
import minimist from 'minimist'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
import pLimit from 'p-limit'
|
import pLimit from 'p-limit'
|
||||||
import path from 'path'
|
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 { 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)
|
const npmPublishLimit = pLimit(5)
|
||||||
|
|
||||||
@@ -43,8 +31,6 @@ const args = minimist(process.argv.slice(2))
|
|||||||
|
|
||||||
const dryRun = true
|
const dryRun = true
|
||||||
|
|
||||||
const logPrefix = dryRun ? chalk.bold.magenta('[dry-run] >') : ''
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const workspace = await getWorkspace()
|
const workspace = await getWorkspace()
|
||||||
await workspace.bumpVersion('canary')
|
await workspace.bumpVersion('canary')
|
||||||
|
|||||||
Reference in New Issue
Block a user