Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: add mac release zip file and release info yml (#2185)

Horusf42d656cfafa
diff --git a/.github/workflows/release-desktop-app.yml b/.github/workflows/release-desktop-app.yml
index 9d5e327191..c8cd109dd7 100644
--- a/.github/workflows/release-desktop-app.yml
+++ b/.github/workflows/release-desktop-app.yml
@@ -76,6 +76,12 @@ jobs:
name: before-make-electron-dist
path: apps/electron/dist
+ - name: Upload YML Build Script
+ uses: actions/upload-artifact@v3
+ with:
+ name: release-yml-build-script
+ path: apps/electron/scripts/generate-yml.js
+
make-distribution:
environment: ${{ github.ref_name == 'master' && 'production' || 'development' }}
strategy:
@@ -122,7 +128,7 @@ jobs:
run: |
mkdir -p builds
mv apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
-
+ mv apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
- name: Save artifacts (windows)
if: ${{ matrix.spec.platform == 'windows' }}
run: |
@@ -169,7 +175,17 @@ jobs:
with:
name: affine-linux-x64-builds
path: ./
-
+ - name: Download Artifacts
+ uses: actions/download-artifact@v3
+ with:
+ name: release-yml-build-script
+ path: ./
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ - name: Generate Release yml
+ run: |
+ RELEASE_VERSION=${{ github.event.inputs.version }} node generate-yml.js
- name: Create Release Draft
uses: softprops/action-gh-release@v1
env:
@@ -188,3 +204,4 @@ jobs:
./RELEASES
./*.AppImage
./*.apk
+ ./*.yml
diff --git a/apps/electron/scripts/generate-yml.js b/apps/electron/scripts/generate-yml.js
new file mode 100644
index 0000000000..13bdb70aa6
--- /dev/null
+++ b/apps/electron/scripts/generate-yml.js
@@ -0,0 +1,63 @@
+// do not run in your local machine
+/* eslint-disable */
+const fs = require('fs');
+const path = require('path');
+const crypto = require('crypto');
+/* eslint-enable */
+
+const yml = {
+ version: process.env.RELEASE_VERSION ?? '0.0.0',
+ files: [],
+};
+
+let fileList = [];
+// TODO: maybe add `beta` and `stable`
+const BUILD_TYPE = process.env.BUILD_TYPE || 'canary';
+
+const generateYml = async () => {
+ fileList = [
+ `affine-${BUILD_TYPE}-macos-arm64.dmg`,
+ `affine-${BUILD_TYPE}-macos-arm64.zip`,
+ `affine-${BUILD_TYPE}-macos-x64.zip`,
+ `affine-${BUILD_TYPE}-macos-x64.dmg`,
+ ];
+ fileList.forEach(fileName => {
+ const filePath = path.join(__dirname, './', fileName);
+ try {
+ const fileData = fs.readFileSync(filePath);
+ const hash = crypto
+ .createHash('sha512')
+ .update(fileData)
+ .digest('base64');
+ const size = fs.statSync(filePath).size;
+
+ yml.files.push({
+ url: fileName,
+ sha512: hash,
+ size: size,
+ });
+ } catch (e) {}
+ });
+ yml.path = yml.files[0].url;
+ yml.sha512 = yml.files[0].sha512;
+ yml.releaseDate = new Date().toISOString();
+
+ const ymlStr =
+ `version: ${yml.version}\n` +
+ `files:\n` +
+ yml.files
+ .map(file => {
+ return (
+ ` - url: ${file.url}\n` +
+ ` sha512: ${file.sha512}\n` +
+ ` size: ${file.size}\n`
+ );
+ })
+ .join('') +
+ `path: ${yml.path}\n` +
+ `sha512: ${yml.sha512}\n` +
+ `releaseDate: ${yml.releaseDate}\n`;
+
+ fs.writeFileSync(`./latest-mac.yml`, ymlStr);
+};
+generateYml();