chore(ci): tag and release next branch (#5218)

This commit is contained in:
YANG QIA 2024-09-06 19:39:07 +08:00 committed by GitHub
parent ae02c86378
commit 9dc566f2db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View File

@ -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 }}

View File

@ -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) {