From b590aa2b7514151def290824dd79b4a93b8218ed Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 14:32:27 +0000 Subject: [PATCH 1/8] add noir-wasm-publishing --- .github/workflows/release-noir-wasm.yml | 81 +++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/release-noir-wasm.yml diff --git a/.github/workflows/release-noir-wasm.yml b/.github/workflows/release-noir-wasm.yml new file mode 100644 index 00000000000..ef4515b855b --- /dev/null +++ b/.github/workflows/release-noir-wasm.yml @@ -0,0 +1,81 @@ +name: Update & Publish + +on: + workflow_dispatch: + inputs: + noir-ref: + description: The noir reference to checkout + required: false + +jobs: + update-and-publish: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/checkout@v3 + with: + repository: "noir-lang/noir" + ref: ${{ inputs.noir-ref || 'master' }} + path: ".cache/noir" + + - name: Collect Revision + id: collect-rev + working-directory: ".cache/noir" + run: | + echo "NOIR_REV_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - uses: cachix/install-nix-action@v20 + with: + nix_path: nixpkgs=channel:nixpkgs-22.05 + + - name: Build with Nix + run: | + nix build -L github:noir-lang/noir/master#wasm + + - name: Configure git + run: | + git config user.name kobyhallx + git config user.email koby@aztecprotocol.com + + - name: Copy output + run: | + cp -r $(readlink result)/* . + + - name: Update version with git hash + if: ${{ !inputs.noir-ref }} + # This will generate the prerelease with something like `.0` but that is okay because it is proper SemVer + run: | + npm version --no-git-tag-version --preid ${{ steps.collect-rev.outputs.NOIR_REV_SHORT }} prerelease + + - name: Commit updates + run: | + git add . + git commit -m "tracking noir@${{ steps.collect-rev.outputs.NOIR_REV_SHORT }}" + git push --force + + - name: Publish to npm (nightly tag) + if: ${{ !inputs.noir-ref }} + run: | + npm publish --tag nightly + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish to npm (latest tag) + if: ${{ inputs.noir-ref }} + run: | + npm publish --tag latest + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file From 5c8553fb1939efd813beacb8a12f2baa24931a1d Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 14:39:32 +0000 Subject: [PATCH 2/8] remove unneeded steps --- .github/workflows/release-noir-wasm.yml | 45 ++++--------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release-noir-wasm.yml b/.github/workflows/release-noir-wasm.yml index ef4515b855b..95250f6d507 100644 --- a/.github/workflows/release-noir-wasm.yml +++ b/.github/workflows/release-noir-wasm.yml @@ -8,25 +8,13 @@ on: required: false jobs: - update-and-publish: + publish-noir-wasm: runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions/checkout@v3 - with: - repository: "noir-lang/noir" - ref: ${{ inputs.noir-ref || 'master' }} - path: ".cache/noir" - - - name: Collect Revision - id: collect-rev - working-directory: ".cache/noir" - run: | - echo "NOIR_REV_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 with: path: | @@ -45,37 +33,16 @@ jobs: run: | nix build -L github:noir-lang/noir/master#wasm - - name: Configure git - run: | - git config user.name kobyhallx - git config user.email koby@aztecprotocol.com - - name: Copy output run: | cp -r $(readlink result)/* . + + - name: Authenticate with npm + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - - name: Update version with git hash - if: ${{ !inputs.noir-ref }} - # This will generate the prerelease with something like `.0` but that is okay because it is proper SemVer - run: | - npm version --no-git-tag-version --preid ${{ steps.collect-rev.outputs.NOIR_REV_SHORT }} prerelease - - - name: Commit updates - run: | - git add . - git commit -m "tracking noir@${{ steps.collect-rev.outputs.NOIR_REV_SHORT }}" - git push --force - - - name: Publish to npm (nightly tag) - if: ${{ !inputs.noir-ref }} - run: | - npm publish --tag nightly - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Publish to npm (latest tag) + - name: Publish to npm if: ${{ inputs.noir-ref }} run: | - npm publish --tag latest + npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file From 0935a8ef0694dfb9e21f0bd27e1c82c14baa14ad Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 14:42:12 +0000 Subject: [PATCH 3/8] remove inputs.ref --- .github/workflows/release-noir-wasm.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/release-noir-wasm.yml b/.github/workflows/release-noir-wasm.yml index 95250f6d507..98c902045d9 100644 --- a/.github/workflows/release-noir-wasm.yml +++ b/.github/workflows/release-noir-wasm.yml @@ -2,10 +2,6 @@ name: Update & Publish on: workflow_dispatch: - inputs: - noir-ref: - description: The noir reference to checkout - required: false jobs: publish-noir-wasm: @@ -41,7 +37,6 @@ jobs: run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - name: Publish to npm - if: ${{ inputs.noir-ref }} run: | npm publish --access public env: From 75fb3f96c2e50c7c7e265f1b21a6b21b04e80c4d Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 14:42:44 +0000 Subject: [PATCH 4/8] update title --- .github/workflows/release-noir-wasm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-noir-wasm.yml b/.github/workflows/release-noir-wasm.yml index 98c902045d9..c5065b5d301 100644 --- a/.github/workflows/release-noir-wasm.yml +++ b/.github/workflows/release-noir-wasm.yml @@ -1,4 +1,4 @@ -name: Update & Publish +name: Release Noir Wasm on: workflow_dispatch: From e976ed84eb824e18b860b13e4837e4fbe7108dc6 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 14:45:01 +0000 Subject: [PATCH 5/8] nix build local flake --- .github/workflows/release-noir-wasm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-noir-wasm.yml b/.github/workflows/release-noir-wasm.yml index c5065b5d301..e2e5117392f 100644 --- a/.github/workflows/release-noir-wasm.yml +++ b/.github/workflows/release-noir-wasm.yml @@ -27,7 +27,7 @@ jobs: - name: Build with Nix run: | - nix build -L github:noir-lang/noir/master#wasm + nix build -L .#wasm - name: Copy output run: | From d73186b0416ab5bb57afbe9a077a29316f3f3ec0 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 15:02:17 +0000 Subject: [PATCH 6/8] call local workflow when publishing noir-wasm --- .github/workflows/release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1be360068da..5968577f971 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,11 +74,9 @@ jobs: - name: Dispatch to noir_wasm uses: benc-uk/workflow-dispatch@v1 with: - workflow: update.yml - repo: noir-lang/noir_wasm + workflow: release-noir-wasm.yml ref: master token: ${{ secrets.NOIR_REPO_TOKEN }} - inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}" }' publish-noir-js: name: Publish noir_js package From 2fe893ba30036d0ce9bc60553950c75bf65ccc5c Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 15:42:37 +0000 Subject: [PATCH 7/8] add export so that this can be accessed in installPhase --- compiler/wasm/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/wasm/build.sh b/compiler/wasm/build.sh index 22acdd06cba..8157e42c6de 100755 --- a/compiler/wasm/build.sh +++ b/compiler/wasm/build.sh @@ -38,7 +38,7 @@ rm -rf $self_path/result >/dev/null 2>&1 if [ -v out ]; then echo "Will install package to $out (defined outside installPhase.sh script)" else - out="$self_path/outputs/out" + export out="$self_path/outputs/out" echo "Will install package to $out" fi From b2349949050933bf32439443f1dbdad2c5337407 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 17:14:46 +0100 Subject: [PATCH 8/8] Update .github/workflows/release-noir-wasm.yml Co-authored-by: Koby Hall <102518238+kobyhallx@users.noreply.github.com> --- .github/workflows/release-noir-wasm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-noir-wasm.yml b/.github/workflows/release-noir-wasm.yml index e2e5117392f..d862ad6993a 100644 --- a/.github/workflows/release-noir-wasm.yml +++ b/.github/workflows/release-noir-wasm.yml @@ -21,9 +21,9 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - uses: cachix/install-nix-action@v20 + - uses: cachix/install-nix-action@v22 with: - nix_path: nixpkgs=channel:nixpkgs-22.05 + nix_path: nixpkgs=channel:nixos-23.05 - name: Build with Nix run: |