Skip to content

Commit

Permalink
Test tag
Browse files Browse the repository at this point in the history
  • Loading branch information
MonicaOlejniczak committed Mar 4, 2024
1 parent 56e5f40 commit feb03d1
Show file tree
Hide file tree
Showing 4 changed files with 2,429 additions and 2,545 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
name: dev-release

on:
push:
branches: molejniczak/test-tags
workflow_dispatch:

jobs:
Expand All @@ -12,4 +14,8 @@ jobs:
uses: ./.github/workflows/release.yml
secrets: inherit
with:
release-command: yarn dev:release
release-command: |
yarn dev:release --summary-file
yarn lerna changed
yarn lerna list --no-private
node scripts/tag-release.mjs --tag dev-test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"husky": "^6.0.0",
"lerna": "^3.22.1",
"lerna": "^6.6.2",
"lint-staged": "^10.2.11",
"mocha": "^8.3.0",
"mocha-junit-reporter": "^2.0.0",
Expand Down
37 changes: 37 additions & 0 deletions scripts/tag-release.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {execSync} from 'node:child_process';
import {readFile} from 'node:fs/promises';
import {URL} from 'node:url';
import {promisify} from 'node:util';

import program from 'commander';

let exec = promisify(execSync);

async function main(tag) {
let publishSummary = JSON.parse(
await readFile(
new URL('../lerna-publish-summary.json', import.meta.url).pathname,
'utf8',
),
);

await Promise.all(
publishSummary.map(({packageName, version}) => {
exec(`yarn tag add ${packageName}@${version} ${tag}`, {
encoding: 'utf8',
});
}),
);
}

let { tag } = program
// TODO Use requiredOption once commander is upgraded in the root
.option('--tag <tag>', 'The npm tag to add to every package published in the latest release')
.parse(process.argv);


if (!tag) {
throw new Error('Required option `tag` not specified');
}

main(tag);
Loading

0 comments on commit feb03d1

Please sign in to comment.