-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
033cbbf
commit cee8471
Showing
4 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env node | ||
|
||
import cpy from 'cpy'; | ||
import { execaCommand } from 'execa'; | ||
import tmp from 'tmp-promise'; | ||
|
||
const command = (cmd, opts) => execaCommand(cmd, { stdio: 'inherit', ...opts }); | ||
|
||
const publishAction = async ({ repo, tag, version }) => { | ||
console.info(`✅ Publishing '${tag}' action to https://github.com/${repo}`); | ||
|
||
const { path, cleanup } = await tmp.dir({ unsafeCleanup: true, prefix: `chromatic-action-` }); | ||
const run = (cmd) => command(cmd, { cwd: path }); | ||
|
||
await cpy(['action/*.js', 'action/*.json', 'action.yml', 'package.json'], path, { | ||
parents: true, | ||
}); | ||
await cpy(['action-src/CHANGELOG.md', 'action-src/LICENSE', 'action-src/README.md'], path); | ||
|
||
await run('git init -b main'); | ||
await run(`git remote add origin git@github.com:${repo}.git`); | ||
await run('git add .'); | ||
await run(`git commit -m ${version}`); | ||
await run('git tag v1'); | ||
await run('git push origin head --force'); | ||
await run('git push --tags --force'); | ||
|
||
return cleanup(); | ||
}; | ||
|
||
/** | ||
* Usage: | ||
* release <major | minor | patch> <canary | next | latest> [--dry-run] | ||
* release action <canary | next | latest> [--dry-run] | ||
*/ | ||
(async () => { | ||
// const [bump, tag, ...rest] = process.argv.slice(2); | ||
|
||
console.log(JSON.stringify(process.argv.slice(1))); | ||
return; | ||
|
||
// if (tag === 'canary') { | ||
// await publishAction({ repo: 'chromaui/action-canary', tag, version }); | ||
// } else if (tag === 'next') { | ||
// await publishAction({ repo: 'chromaui/action-next', tag, version }); | ||
// } else { | ||
// await publishAction({ repo: 'chromaui/action-next', tag, version }); | ||
// await publishAction({ repo: 'chromaui/action', tag, version }); | ||
// } | ||
|
||
// if (tag === 'latest' && bump !== 'action') { | ||
// const tagCommand = `npm dist-tag add chromatic@${version} next`; | ||
// console.log(`⚠️ Don't forget to update the 'next' tag by running:\n ${tagCommand}`); | ||
// } | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters