diff --git a/.github/workflows/release-next.yml b/.github/workflows/release-next.yml index 022e70c7bb..bcb770faed 100644 --- a/.github/workflows/release-next.yml +++ b/.github/workflows/release-next.yml @@ -139,3 +139,10 @@ jobs: bash generate-npmignore.sh ignore-src npm config set //pkg-src.nocobase.com/:_authToken=${{ env.PKG_SRC_NOCOBASE_TOKEN }} yarn release:force --no-verify-access --no-git-reset --registry https://pkg-src.nocobase.com --dist-tag=next + - name: Run script + shell: bash + run: | + node scripts/release/changelogAndRelease.js --ver alpha + env: + PRO_PLUGIN_REPOS: ${{ vars.NEXT_PRO_PLUGIN_REPOS }} + GH_TOKEN: ${{ steps.app-token.outputs.token }} diff --git a/scripts/release/changelogAndRelease.js b/scripts/release/changelogAndRelease.js index 716158db3e..b3ea6a4b70 100644 --- a/scripts/release/changelogAndRelease.js +++ b/scripts/release/changelogAndRelease.js @@ -95,10 +95,11 @@ async function parsePackage(files, pkgType, pkg) { } async function parsePR(number, pkgType, cwd, pkg, retries = 10) { + let { ver = 'beta' } = program.opts(); // gh pr view 5112 --json author,body,files let res; try { - const { stdout } = await execa('gh', ['pr', 'view', number, '--json', 'author,body,files'], { cwd }); + const { stdout } = await execa('gh', ['pr', 'view', number, '--json', 'author,body,files,baseRefName'], { cwd }); res = stdout; } catch (error) { console.error(`Get PR #${number} failed, error: ${error.message}`); @@ -109,7 +110,10 @@ async function parsePR(number, pkgType, cwd, pkg, retries = 10) { } return { number }; } - const { author, body, files } = JSON.parse(res); + const { author, body, files, baseRefName } = JSON.parse(res); + if (ver === 'alpha' && baseRefName !== 'next') { + return { number }; + } const typeRegExp = /\[x\] ([^(\\\r)]+)/; const typeMatch = body.match(typeRegExp); const prType = typeMatch ? typeMatch[1] : ''; @@ -211,7 +215,11 @@ async function collect() { console.log('===nocobase/nocobase==='); await get(changelogs, 'oss'); console.log('===nocobase/pro-plugins==='); - await get(changelogs, 'pro', path.join(__dirname, '../../packages/pro-plugins/')); + try { + await get(changelogs, 'pro', path.join(__dirname, '../../packages/pro-plugins/')); + } catch (error) { + console.error(`Generate changelog for pro-plugins failed, error: ${error.message}`); + } if (process.env.PRO_PLUGIN_REPOS) { const repos = JSON.parse(process.env.PRO_PLUGIN_REPOS); for (const repo of repos) {