Skip to content

Commit

Permalink
Merge pull request #1098 from chromaui/cody/cap-2324-create-a-new-act…
Browse files Browse the repository at this point in the history
…ion-to-properly-test-the-action

Add new check to test the CLI action in merge queue
  • Loading branch information
codykaup authored Oct 18, 2024
2 parents f1bfdb4 + 9eeb9e0 commit 3d3e491
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Lint and Test
on: push
on: [push, merge_group]

permissions:
contents: read
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/smoke-test-action-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Smoke test via action next
on: merge_group

permissions:
contents: read

jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: lts/*
- run: corepack enable
- run: yarn
- name: Push to action-next
run: yarn run release-next
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Run build against action-next
uses: chromaui/action-next@latest
with:
buildScriptName: build-test-storybook
exitZeroOnChanges: true
forceRebuild: true
env:
LOG_LEVEL: debug
DEBUG: chromatic-cli
CHROMATIC_PROJECT_TOKEN: ${{ secrets.SMOKE_TESTS_CHROMATIC_PROJECT_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --report-unused-disable-directives",
"lint:package": "sort-package-json",
"release": "./scripts/release.mjs",
"release-next": "./scripts/releaseNext.mjs",
"prepack": "clean-package",
"postpack": "clean-package restore",
"publish-action": "./scripts/publishAction.mjs",
Expand Down
36 changes: 36 additions & 0 deletions scripts/releaseNext.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env node

import { $ } from 'execa';

import { main as publishAction } from './publishAction.mjs';

async function main() {
const { stdout: status } = await $`git status --porcelain`;
if (status) {
console.error(`❗️ Working directory is not clean:\n${status}`);
return;
}

await build();
await publishAction('next');
}

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

console.info(`📌 Temporarily bumping version to '${nextVersion}' for build step`);
await $`npm --no-git-tag-version version ${nextVersion}`;

console.info('📦 Building with new version');
await $({
stdio: 'inherit',
env: {
...process.env,
SENTRY_RELEASE: nextVersion,
},
})`yarn build`;

console.info('✅ Build with new version completed, ready for push to action-next!');
}

main();

0 comments on commit 3d3e491

Please sign in to comment.