Skip to content

Commit

Permalink
fix: add workflow to check release version match with package.json (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
m1911star committed May 17, 2023
1 parent c870104 commit 02e1f52
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/nightly-build.yml
Expand Up @@ -66,6 +66,7 @@ jobs:
API_SERVER_PROFILE: prod
ENABLE_TEST_PROPERTIES: false
ENABLE_IMAGE_PREVIEW_MODAL: false
RELEASE_VERSION: ${{ needs.set-build-version.outputs.version }}

- name: Upload Artifact (web-static)
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-desktop-app.yml
Expand Up @@ -67,6 +67,7 @@ jobs:
API_SERVER_PROFILE: prod
ENABLE_TEST_PROPERTIES: false
ENABLE_IMAGE_PREVIEW_MODAL: false
RELEASE_VERSION: ${{ github.event.inputs.version }}

- name: Upload Artifact (web-static)
uses: actions/upload-artifact@v3
Expand Down
14 changes: 13 additions & 1 deletion apps/electron/scripts/generate-assets.mjs
Expand Up @@ -9,6 +9,7 @@ const publicDistDir = path.join(electronRootDir, 'resources');
const affineWebDir = path.join(repoRootDir, 'apps', 'web');
const affineWebOutDir = path.join(affineWebDir, 'out');
const publicAffineOutDir = path.join(publicDistDir, `web-static`);
const releaseVersionEnv = process.env.RELEASE_VERSION || '';

console.log('build with following dir', {
repoRootDir,
Expand All @@ -19,9 +20,20 @@ console.log('build with following dir', {
publicAffineOutDir,
});

// step 0: check version match
const electronPackageJson = await import(`${electronRootDir}/package.json`, {
assert: {
type: 'json',
},
});
if (releaseVersionEnv && electronPackageJson.version !== releaseVersionEnv) {
throw new Error(
`Version mismatch, expected ${releaseVersionEnv} but got ${electronPackageJson.version}`
);
}
// copy web dist files to electron dist

// step 0: clean up
// step 1: clean up
await cleanup();
echo('Clean up done');

Expand Down

2 comments on commit 02e1f52

@vercel
Copy link

@vercel vercel bot commented on 02e1f52 May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 02e1f52 May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

affine-storybook – ./packages/component

affine-storybook.vercel.app
affine-storybook-git-master-toeverything.vercel.app
storybook.affine.pro
affine-storybook-toeverything.vercel.app

Please sign in to comment.