diff --git a/.github/workflows/cortex-build.yml b/.github/workflows/cortex-build.yml index 8bd635197..da78c7285 100644 --- a/.github/workflows/cortex-build.yml +++ b/.github/workflows/cortex-build.yml @@ -45,19 +45,19 @@ jobs: runs-on: "ubuntu-20-04" cmake-flags: "" build-deps-cmake-flags: "" - ccache-dir: '' + ccache-dir: "" - os: "mac" name: "amd64" runs-on: "macos-13" cmake-flags: "" build-deps-cmake-flags: "" - ccache-dir: '' + ccache-dir: "" - os: "mac" name: "arm64" runs-on: "macos-latest" cmake-flags: "-DMAC_ARM64=ON" build-deps-cmake-flags: "" - ccache-dir: '' + ccache-dir: "" - os: "windows" name: "amd64" runs-on: "windows-cuda-12-0" @@ -116,7 +116,7 @@ jobs: run: | cd cortex-cpp make pre-package - + - name: Code Signing macOS if: runner.os == 'macOS' run: | @@ -163,6 +163,64 @@ jobs: AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}" AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}" + ## cortex-cpp node binding + + # update version in package.json + - name: Install jq + uses: dcarbone/install-jq-action@v2.0.1 + + - uses: actions/setup-node@v3 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + + - name: "Update version by tag" + working-directory: cortex-cpp + shell: bash + run: | + echo "Version: ${{ needs.create-draft-release.outputs.version }}" + # Update the version in package.json + jq --arg version "${{ needs.create-draft-release.outputs.version }}" '.version = $version' package.json > /tmp/package.json + mv /tmp/package.json package.json + + # build prebuilds + - name: Build Prebuilds + working-directory: cortex-cpp + run: | + yarn | yarn prebuilds + + # upload prebuilds + - name: Upload Prebuilds Darwin + uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && matrix.os == 'mac' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./cortex-cpp/cortex-cpp-v${{ needs.create-draft-release.outputs.version }}-napi-v8-darwin-{{ matrix.name }}.tar.gz + asset_name: cortex-cpp-v${{ needs.create-draft-release.outputs.version }}-napi-v8-darwin-{{ matrix.name }}.tar.gz + asset_content_type: application/gzip + + - name: Upload Prebuilds Others + uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && matrix.os != 'mac' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./cortex-cpp/cortex-cpp-v${{ needs.create-draft-release.outputs.version }}-napi-v8-${{ matrix.os }}-{{ matrix.name }}.tar.gz + asset_name: cortex-cpp-v${{ needs.create-draft-release.outputs.version }}-napi-v8-${{ matrix.os }}-{{ matrix.name }}.tar.gz + asset_content_type: application/gzip + + # Setup .npmrc file to publish to npm - upload only once + - run: npm publish --access public + if: runner.os == 'linux' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + working-directory: ./cortex-cpp + + ## cortex-cpp node binding + build-cortex-single-binary: runs-on: ${{ matrix.runs-on }} needs: [create-draft-release] @@ -229,7 +287,7 @@ jobs: with: python-version: "3.10" - - run: pip3 install --upgrade setuptools + - run: pip3 install --upgrade setuptools if: runner.os == 'macOS' - run: yarn install && yarn build:binary