Browse Source

add build support for linux arm64

KaMeHb-UA 1 year ago
parent
commit
87dbf5ca21
2 changed files with 75 additions and 8 deletions
  1. 74 8
      .github/workflows/build-desktop-release.yml
  2. 1 0
      resources/package.json

+ 74 - 8
.github/workflows/build-desktop-release.yml

@@ -222,7 +222,7 @@ jobs:
           DEBUG: "pw:api"
           RELEASE: true # skip dev only test
 
-  build-linux:
+  build-linux-x64:
     runs-on: ubuntu-20.04
     needs: [ compile-cljs ]
     steps:
@@ -265,7 +265,61 @@ jobs:
       - name: Upload Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: logseq-linux-builds
+          name: logseq-linux-x64-builds
+          path: builds
+
+  build-linux-arm64:
+    runs-on: ubuntu-20.04
+    needs: [ compile-cljs ]
+    steps:
+      - name: Download The Static Asset
+        uses: actions/download-artifact@v3
+        with:
+          name: static
+          path: static
+
+      - name: Retrieve tag version
+        id: ref
+        run: |
+          pkgver=$(cat ./static/VERSION)
+          echo "version=$pkgver" >> $GITHUB_OUTPUT
+
+      - name: Install Node.js, NPM and Yarn
+        uses: actions/setup-node@v3
+        with:
+          node-version: ${{ env.NODE_VERSION }}
+
+      - name: Fetch deps
+        env:
+          npm_config_arch: arm64
+        run: |
+          yarn install --target_arch=arm64 --target_platform=linux
+          rsapi_version=`node -e 'console.log(require("@logseq/rsapi/package.json").optionalDependencies["@logseq/rsapi-linux-arm64-gnu"])'`
+          temp_dir=`mktemp -d`
+          cd "$temp_dir"
+          echo '{"dependencies": {"@logseq/rsapi-linux-arm64-gnu": "'"$rsapi_version"'"}}' > package.json
+          yarn install --ignore-platform
+          cd -
+          mv "$temp_dir/node_modules/@logseq/rsapi-linux-arm64-gnu" node_modules/@logseq/rsapi-linux-arm64-gnu
+          rm -rf "$temp_dir" "node_modules/@logseq/rsapi-linux-x64-gnu"
+        working-directory: ./static
+
+      - name: Build/Release Electron App
+        run: yarn electron:make-linux-arm64
+        working-directory: ./static
+
+      - name: Save artifacts
+        run: |
+          mkdir -p builds
+          # NOTE: save VERSION file to builds directory
+          cp static/VERSION ./builds/VERSION
+          # mv static/out/make/*-*.AppImage ./builds/Logseq-linux-arm64-${{ steps.ref.outputs.version }}.AppImage
+          mv static/out/make/zip/linux/arm64/*-linux-arm64-*.zip ./builds/Logseq-linux-arm64-${{ steps.ref.outputs.version }}.zip
+
+      - name: Upload Artifact
+        uses: actions/upload-artifact@v3
+        with:
+          name: logseq-linux-arm64-builds
           path: builds
 
   build-windows:
@@ -498,7 +552,7 @@ jobs:
 
   nightly-release:
     if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly' }}
-    needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows, build-android, e2e-test ]
+    needs: [ build-macos-x64, build-macos-arm64, build-linux-x64, build-linux-arm64, build-windows, build-android, e2e-test ]
     runs-on: ubuntu-20.04
     steps:
       - name: Download MacOS x64 Artifacts
@@ -513,10 +567,16 @@ jobs:
           name: logseq-darwin-arm64-builds
           path: ./
 
-      - name: Download The Linux Artifacts
+      - name: Download The Linux x64 Artifacts
         uses: actions/download-artifact@v3
         with:
-          name: logseq-linux-builds
+          name: logseq-linux-x64-builds
+          path: ./
+
+      - name: Download The Linux arm64 Artifacts
+        uses: actions/download-artifact@v3
+        with:
+          name: logseq-linux-arm64-builds
           path: ./
 
       - name: Download The Windows Artifact
@@ -565,7 +625,7 @@ jobs:
   release:
     # NOTE: For now, we only have beta channel to be released on Github
     if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.build-target == 'beta' }}
-    needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows, e2e-test ]
+    needs: [ build-macos-x64, build-macos-arm64, build-linux-x64, build-linux-arm64, build-windows, e2e-test ]
     runs-on: ubuntu-20.04
     steps:
       - name: Download MacOS x64 Artifacts
@@ -580,10 +640,16 @@ jobs:
           name: logseq-darwin-arm64-builds
           path: ./
 
-      - name: Download The Linux Artifacts
+      - name: Download The Linux x64 Artifacts
+        uses: actions/download-artifact@v3
+        with:
+          name: logseq-linux-x64-builds
+          path: ./
+
+      - name: Download The Linux arm64 Artifacts
         uses: actions/download-artifact@v3
         with:
-          name: logseq-linux-builds
+          name: logseq-linux-arm64-builds
           path: ./
 
       - name: Download The Windows Artifact

+ 1 - 0
resources/package.json

@@ -11,6 +11,7 @@
     "electron:dev": "electron-forge start",
     "electron:debug": "electron-forge start --inspect-electron",
     "electron:make": "electron-forge make",
+    "electron:make-linux-arm64": "electron-forge make --platform=linux --arch=arm64",
     "electron:make-macos-arm64": "electron-forge make --platform=darwin --arch=arm64",
     "electron:publish:github": "electron-forge publish",
     "rebuild:all": "electron-rebuild -v 27.1.3 -f",