Skip to content

Commit

Permalink
Move deployment to single script
Browse files Browse the repository at this point in the history
  • Loading branch information
codykaup committed Oct 8, 2024
1 parent be33c60 commit 742bd7e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 36 deletions.
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"lint": "yarn lint:js bin-src node-src test-stories ./isChromatic.js ./isChromatic.mjs",
"lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --report-unused-disable-directives",
"lint:package": "sort-package-json",
"release": "./scripts/versionAndBuildForRelease.mjs && auto shipit",
"release": "./scripts/release.mjs",
"prepack": "clean-package",
"postpack": "clean-package restore",
"publish-action": "./scripts/publish-action.mjs",
Expand All @@ -100,7 +100,6 @@
"@actions/core": "^1.10.0",
"@actions/github": "^5.0.0",
"@antfu/ni": "^0.21.5",
"@auto-it/exec": "^11.0.4",
"@auto-it/slack": "^11.1.6",
"@discoveryjs/json-ext": "^0.5.7",
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
Expand Down Expand Up @@ -233,12 +232,6 @@
"plugins": [
"npm",
"released",
[
"exec",
{
"afterShipIt": "yarn run publish-action"
}
],
[
"slack",
{
Expand Down
13 changes: 0 additions & 13 deletions scripts/publish-action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ const publishAction = async ({ major, version, repo }) => {
version = pkg.version;
console.info(`📌 Using context arg: ${context}`);
console.info(`📌 Using package.json version: ${version}`);
} else {
const data = JSON.parse(process.env.ARG_0);
context = data.context;
version = data.newVersion.replace(/^v/, '');
console.info(`📌 Using auto shipIt context: ${context}`);
console.info(`📌 Using auto shipIt version: ${version}`);
console.info(`Commits in release:`);
data.commitsInRelease.forEach((c) => console.info(`- ${c.hash.slice(0, 8)} ${c.subject}`));
}

const [, major, minor, patch] = version.match(/^(\d+)\.(\d+)\.(\d+)-*(\w+)?/) || [];
Expand All @@ -93,11 +85,6 @@ const publishAction = async ({ major, version, repo }) => {

switch (context) {
case 'canary':
if (process.argv[2] !== 'canary') {
console.info('Skipping automatic publish of action-canary.');
console.info('Run `yarn publish-action canary` to publish a canary action.');
return;
}
await publishAction({ major, version, repo: 'chromaui/action-canary' });
break;
case 'next':
Expand Down
13 changes: 13 additions & 0 deletions scripts/versionAndBuildForRelease.mjs → scripts/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ async function main() {
return;
}

await build();
await $({ stdout: 'inherit', stderr: 'inherit' })`auto shipit`;

if (process.env.GITHUB_REF === 'main') {
await $({ stdout: 'inherit', stderr: 'inherit' })`yarn publish-action latest`;
} else {
console.info('Skipping automatic publish of action-canary.');
console.info('Run `yarn publish-action canary` to publish a canary action.');
return;
}
}

async function build() {
const { stdout: nextVersion } = await $`auto shipit --dry-run --quiet`;

console.info(`📌 Temporarily bumping version to '${nextVersion}' for build step`);
Expand Down
15 changes: 0 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,6 @@ __metadata:
languageName: node
linkType: hard

"@auto-it/exec@npm:^11.0.4":
version: 11.1.6
resolution: "@auto-it/exec@npm:11.1.6"
dependencies:
"@auto-it/core": "npm:11.1.6"
endent: "npm:^2.1.0"
fp-ts: "npm:^2.5.3"
fromentries: "npm:^1.2.0"
io-ts: "npm:^2.1.2"
tslib: "npm:2.1.0"
checksum: 10c0/190cc3f7f8e676bf7fe04ed0dfb9c3b39591ffb472a412f1890e1329cdbc93610c0780a8fe3a38ec86cb9f089b2a585ad819e649c1df77ba12225b6159224503
languageName: node
linkType: hard

"@auto-it/npm@npm:11.1.6":
version: 11.1.6
resolution: "@auto-it/npm@npm:11.1.6"
Expand Down Expand Up @@ -7539,7 +7525,6 @@ __metadata:
"@actions/core": "npm:^1.10.0"
"@actions/github": "npm:^5.0.0"
"@antfu/ni": "npm:^0.21.5"
"@auto-it/exec": "npm:^11.0.4"
"@auto-it/slack": "npm:^11.1.6"
"@discoveryjs/json-ext": "npm:^0.5.7"
"@eslint-community/eslint-plugin-eslint-comments": "npm:^4.3.0"
Expand Down

0 comments on commit 742bd7e

Please sign in to comment.