diff --git a/.github/workflows/cortex-build.yml b/.github/workflows/cortex-build.yml index ec30545c1..997f69501 100644 --- a/.github/workflows/cortex-build.yml +++ b/.github/workflows/cortex-build.yml @@ -163,6 +163,58 @@ 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 + uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + {{if eq matrix.os "macos"}} + 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 + {{else}} + 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 + {{end}} + 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]