From 324aefef862477acc003686a0ce74990f54db459 Mon Sep 17 00:00:00 2001 From: sh <37271604+shumvgolove@users.noreply.github.com> Date: Mon, 12 Jan 2026 17:30:35 +0000 Subject: [PATCH] ci: add nodejs action (#6568) * ci: add nodejs action * ci: better curl flags * ci: fix naming --- .github/workflows/build.yml | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f73bfa7927..05bf62f7fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -582,3 +582,74 @@ jobs: bin_hash: ${{ steps.windows_desktop_build.outputs.package_hash }} github_ref: ${{ github.ref }} github_token: ${{ secrets.GITHUB_TOKEN }} + +# ========================= +# NodeJS libs release +# ========================= + +# Downloads Desktop builds, extracts and archives libraries for NodeJS addon. +# Depends on Linux/MacOS, executes only on release. + +# Secrets: +# ------- +# NODEJS_REPO_TOKEN +# Only select repositories: simplex-chat-libs +# Permissions: +# * Contents (Read and Write) + + release-nodejs-libs: + runs-on: ubuntu-latest + needs: [build-linux, build-macos] + if: startsWith(github.ref, 'refs/tags/v') && (!cancelled()) + steps: + - name: Checkout current repository + uses: actions/checkout@v6 + + - name: Build archives + run: | + INIT_DIR='${{ runner.temp }}/artifacts' + RELEASE_DIR='${{ runner.temp }}/release-assets' + TAG='${{ github.ref_name }}' + URL='https://github.com/${{ github.repository }}/releases/download' + PREFIX='${{ github.event.repository.name }}-libs' + + # Setup directories + mkdir "$INIT_DIR" "$RELEASE_DIR" && cd "$INIT_DIR" + + # Downlaod desktop release + curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-ubuntu-22_04-x86_64.deb" -o linux.deb + curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-macos-aarch64.dmg" -o macos-aarch64.dmg + curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-macos-x86_64.dmg" -o macos-x86_64.dmg + + # Linux + # ----- + # Extract libraries + dpkg-deb -R linux.deb linux-out/ && cd linux-out/opt/simplex/lib/app/resources + # Preprare directory + mkdir libs && cp *.so libs/ + # Archive + zip -r "${PREFIX}-linux-x86_64.zip" libs + # Back to original dir + mv "${PREFIX}-linux-x86_64.zip" "$RELEASE_DIR" && cd "$INIT_DIR" + + # MacOS: aarch64 + # -------------- + 7z x macos-aarch64.dmg -omacos1-out/ && cd macos1-out/SimpleX/SimpleX.app/Contents/app/resources/ + mkdir libs && cp *.dylib libs/ + zip -r "${PREFIX}-macos-aarch64.zip" libs + mv "${PREFIX}-macos-aarch64.zip" "$RELEASE_DIR" && cd "$INIT_DIR" + + # Macos: x86_64 + # ------------- + 7z x macos-x86_64.dmg -omacos2-out/ && cd macos2-out/SimpleX/SimpleX.app/Contents/app/resources/ + mkdir libs && cp *.dylib libs/ + zip -r "${PREFIX}-macos-x86_64.zip" libs + mv "${PREFIX}-macos-x86_64.zip" "$RELEASE_DIR" && cd "$INIT_DIR" + + - name: Create release in libs repo and upload artifacts + uses: softprops/action-gh-release@v2 + with: + repository: ${{ github.repository }}-libs + tag_name: ${{ github.ref_name }} + files: ${{ runner.temp }}/release-assets/* + token: ${{ secrets.NODEJS_REPO_TOKEN }}