diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 27370ab2..2abc2142 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -59,3 +59,49 @@ jobs: push: true tags: textile/tableland:latest,textile/tableland:${{ github.ref_name }} platforms: linux/amd64, linux/arm64 + js-release: + runs-on: ubuntu-latest + if: ${{ success() }} + needs: [binaries] + steps: + - run: echo "release_version ${{ github.ref_name }}" + + - name: PR to publish this release via the npm package + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.TEXTILEIO_MACHINE_ACCESS_TOKEN }} + script: | + // This triggers the release-pr workflow in the js-validator repo + // which will create a pull request in that repo to update the binaries + // on npm with this release + try { + const ownerOrg = 'tablelandnetwork'; + + // if the tag/release has a preceeding "v" we want to remove + // it and match standard symantics in the js ecosystem + let version = '${{ github.ref_name }}'; + if (/^v[0-9]/.test(version)) { + version = version.slice(1); + } + + const options = { + owner: ownerOrg, + repo: 'js-validator', + workflow_id: 'release-pr.yml', + ref: 'main', + inputs: { + release_version: version + } + }; + + console.log(options); + + const response = await github.rest.actions.createWorkflowDispatch(options); + + if (response.status !== 204) { + core.setFailed(`create workflow_dispatch received status code ${response.status}`); + } + } catch(err) { + console.log(err); + core.setFailed(err.message); + }