mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
ci: separate release groups (#2775)
This commit is contained in:
parent
f42b82d13b
commit
f7a2bdf7a8
4 changed files with 52 additions and 9 deletions
16
.github/workflows/changesets.yml
vendored
16
.github/workflows/changesets.yml
vendored
|
@ -11,14 +11,16 @@ concurrency:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changesets:
|
changesets:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
group: [core, toolkit]
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
# Set Git operations with the bot PAT since we have tag protection rule
|
|
||||||
token: ${{ secrets.BOT_PAT }}
|
token: ${{ secrets.BOT_PAT }}
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Node and pnpm
|
- name: Setup Node and pnpm
|
||||||
uses: silverhand-io/actions-node-pnpm-run-steps@v2
|
uses: silverhand-io/actions-node-pnpm-run-steps@v2
|
||||||
|
@ -39,7 +41,7 @@ jobs:
|
||||||
|
|
||||||
- name: Version packages
|
- name: Version packages
|
||||||
run: |
|
run: |
|
||||||
pnpm changeset version
|
node .scripts/version.js ${{ matrix.group }}
|
||||||
pnpm i --no-frozen-lockfile
|
pnpm i --no-frozen-lockfile
|
||||||
git status
|
git status
|
||||||
|
|
||||||
|
@ -48,10 +50,10 @@ jobs:
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.BOT_PAT }}
|
token: ${{ secrets.BOT_PAT }}
|
||||||
commit-message: 'release: version packages'
|
commit-message: 'release: version ${{ matrix.group }} packages'
|
||||||
committer: silverhand-bot <bot@silverhand.io>
|
committer: silverhand-bot <bot@silverhand.io>
|
||||||
author: silverhand-bot <bot@silverhand.io>
|
author: silverhand-bot <bot@silverhand.io>
|
||||||
base: master
|
base: master
|
||||||
branch: release/version-packages
|
branch: release/version-${{ matrix.group }}-packages
|
||||||
title: 'release: version packages'
|
title: 'release: version ${{ matrix.group }} packages'
|
||||||
body: 'This is an automatic pull request from the result of `pnpm changeset version` command. Merge it will trigger the publish flow for versioned packages.'
|
body: 'This is an automatic pull request from the result of `node .scripts/version.js ${{ matrix.group }}` command. Merge it will trigger the publish flow for versioned packages.'
|
||||||
|
|
41
.scripts/version.js
Normal file
41
.scripts/version.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
import { exec } from 'node:child_process';
|
||||||
|
import { promisify } from 'node:util';
|
||||||
|
|
||||||
|
const execAsync = promisify(exec);
|
||||||
|
const versionGroup = process.argv[2];
|
||||||
|
|
||||||
|
if (process.argv.length > 3) {
|
||||||
|
throw new Error('Extraneous arguments found. Only one optional argument for version group name is allowed.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is configured based on our practice. Change with care.
|
||||||
|
const allowedGroups = { core: 'core', toolkit: 'toolkit' };
|
||||||
|
if (!Object.values(allowedGroups).includes(versionGroup)) {
|
||||||
|
throw new Error('Version group is invalid. Should be one of ' + Object.values(allowedGroups).join(', ') + '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const { allPackages } = await import('./packages-meta.js');
|
||||||
|
|
||||||
|
const getIgnoreGroup = () => {
|
||||||
|
console.log(`=== Versioning ${versionGroup} group packages ===`);
|
||||||
|
|
||||||
|
return allPackages.filter(({ path }) => {
|
||||||
|
if (versionGroup === allowedGroups.toolkit) {
|
||||||
|
return !path.includes(allowedGroups.toolkit + '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const ignoreCmd = getIgnoreGroup()
|
||||||
|
.map(({ name }) => ` \\\n --ignore ${name}`)
|
||||||
|
.join('');
|
||||||
|
const cmd = ('pnpm changeset version' + ignoreCmd);
|
||||||
|
|
||||||
|
console.log(cmd);
|
||||||
|
|
||||||
|
await execAsync(cmd).catch(({ stderr, code }) => {
|
||||||
|
console.error(stderr);
|
||||||
|
process.exit(code ?? 1);
|
||||||
|
});
|
|
@ -21,7 +21,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/types": "^29.1.2",
|
"@jest/types": "^29.1.2",
|
||||||
"@logto/connector-kit": "workspace:1.0.0-beta.30",
|
"@logto/connector-kit": "workspace:*",
|
||||||
"@logto/js": "1.0.0-beta.14",
|
"@logto/js": "1.0.0-beta.14",
|
||||||
"@logto/node": "1.0.0-beta.14",
|
"@logto/node": "1.0.0-beta.14",
|
||||||
"@logto/schemas": "workspace:*",
|
"@logto/schemas": "workspace:*",
|
||||||
|
|
|
@ -462,7 +462,7 @@ importers:
|
||||||
packages/integration-tests:
|
packages/integration-tests:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@jest/types': ^29.1.2
|
'@jest/types': ^29.1.2
|
||||||
'@logto/connector-kit': workspace:1.0.0-beta.30
|
'@logto/connector-kit': workspace:*
|
||||||
'@logto/js': 1.0.0-beta.14
|
'@logto/js': 1.0.0-beta.14
|
||||||
'@logto/node': 1.0.0-beta.14
|
'@logto/node': 1.0.0-beta.14
|
||||||
'@logto/schemas': workspace:*
|
'@logto/schemas': workspace:*
|
||||||
|
|
Loading…
Reference in a new issue