diff --git a/.github/workflows/build-static.yml b/.github/workflows/build-static.yml new file mode 100644 index 0000000..484b246 --- /dev/null +++ b/.github/workflows/build-static.yml @@ -0,0 +1,43 @@ +name: CI + +on: + release: + types: [created] + push: + branches: [ "main", "dev-ohos-static" ] + schedule: + - cron: '0 17 * * *' + +permissions: write-all + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + - name: set Node.js branch or tag name + run: | + if [ "${{ github.event_name }}" == "release" ]; then + echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + else + echo "VERSION=main" >> $GITHUB_ENV + fi + - name: build + run: ./build.sh ${{ env.VERSION }} + - name: upload artifact + uses: actions/upload-artifact@v4 + with: + path: "./node/node-${{ env.VERSION }}-openharmony-arm64.tar.gz" + compression-level: 0 + retention-days: 7 + - name: upload release asset + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: "./node/node-${{ env.VERSION }}-openharmony-arm64.tar.gz" + asset_name: "node-${{ env.VERSION }}-openharmony-arm64.tar.gz" + asset_content_type: application/octet-stream diff --git a/build.sh b/build.sh index d80e7db..649c9db 100755 --- a/build.sh +++ b/build.sh @@ -59,10 +59,11 @@ if echo " $need_no_error_versions " | grep -q " $version "; then fi export CC_host="gcc" export CXX_host="g++" -./configure --dest-cpu=arm64 --dest-os=openharmony --cross-compiling --prefix=node-${version}-openharmony-arm64 +./configure --dest-cpu=arm64 --dest-os=openharmony --cross-compiling --prefix=node-${version}-openharmony-arm64 --fully-static --enable-static make -j$(nproc) make install + # code signing /opt/ohos-sdk/linux/toolchains/lib/binary-sign-tool sign \ -inFile node-${version}-openharmony-arm64/bin/node \