Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add workflow to check release version match with package.json #2420

Merged
merged 2 commits into from May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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