diff --git a/.github/workflows/publish-es-packages.yml b/.github/workflows/publish-es-packages.yml index b29740d5502..c05e9fcacc9 100644 --- a/.github/workflows/publish-es-packages.yml +++ b/.github/workflows/publish-es-packages.yml @@ -6,11 +6,12 @@ on: noir-ref: description: The noir reference to checkout required: false - nightly: - description: Indicates this is a nightly release + npm-tag: + description: Repository Tag to publish under required: false - type: boolean - default: true + default: 'nightly' + +run-name: Publish ES Packages from ${{ inputs.noir-ref }} under @${{ inputs.npm-tag }} tag. jobs: build-noir_wasm: @@ -28,6 +29,11 @@ jobs: nix-cache-name: ${{ vars.NIX_CACHE_NAME }} cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + - name: Enable aztec features + if: ${{ inputs.npm-tag == 'aztec' }} + run: | + echo "\ndefault = [\"aztec\"]" >> compiler/noirc_frontend/Cargo.toml + - name: Build wasm package run: | nix build -L .#noir_wasm @@ -89,17 +95,25 @@ jobs: - name: Install Yarn dependencies run: yarn install + - name: Enable aztec features + if: ${{ inputs.npm-tag == 'aztec' }} + run: | + echo "\ndefault = [\"aztec\"]" >> compiler/noirc_frontend/Cargo.toml + - name: Build ES Packages run: yarn prepare:publish - name: Prepare nightly version - if: ${{ inputs.nightly }} + if: ${{ inputs.npm-tag != 'latest' }} run: | - sudo apt-get install jq yarn nightly:version + - name: Update Version as specific tag + run: | + jq '.version = .version + "-${{ inputs.npm-tag }}"' package.json > package-tmp.json && mv package-tmp.json package.json + - name: Authenticate with npm run: "echo npmAuthToken: ${{ secrets.NPM_TOKEN }} > ~/.yarnrc.yml" - name: Publish ES Packages - run: yarn publish:all --access public ${{ inputs.nightly && ' --tag nightly' }} \ No newline at end of file + run: yarn publish:all --access public --tag ${{ inputs.npm-tag }} diff --git a/.github/workflows/publish-nightly.yml b/.github/workflows/publish-nightly.yml index 9e8299bc597..f5c013883bb 100644 --- a/.github/workflows/publish-nightly.yml +++ b/.github/workflows/publish-nightly.yml @@ -23,4 +23,4 @@ jobs: with: workflow: publish-es-packages.yml token: ${{ secrets.NOIR_REPO_TOKEN }} - inputs: "{ \"noir-ref\": \"${{ env.GITHUB_REF }}\", \"nightly\": true }" + inputs: "{ \"noir-ref\": \"${{ env.GITHUB_REF }}\", \"npm-tag\": \"nightly\" }" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b1c61e2a5c4..2786bc32970 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,4 +77,4 @@ jobs: workflow: publish-es-packages.yml ref: master token: ${{ secrets.NOIR_REPO_TOKEN }} - inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}", "nightly": false }' \ No newline at end of file + inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}", "npm-tag": "latest" }' \ No newline at end of file diff --git a/compiler/wasm/buildPhaseCargoCommand.sh b/compiler/wasm/buildPhaseCargoCommand.sh index 1188d00953e..2ab0f1eb3cb 100755 --- a/compiler/wasm/buildPhaseCargoCommand.sh +++ b/compiler/wasm/buildPhaseCargoCommand.sh @@ -32,7 +32,7 @@ NODE_WASM=${NODE_DIR}/${pname}_bg.wasm BROWSER_WASM=${BROWSER_DIR}/${pname}_bg.wasm # Build the new wasm package -run_or_fail cargo build --lib --release --target $TARGET --package ${pname} +run_or_fail cargo build --lib --release --target $TARGET --package ${pname} ${cargoExtraArgs} run_or_fail wasm-bindgen $WASM_BINARY --out-dir $NODE_DIR --typescript --target nodejs run_or_fail wasm-bindgen $WASM_BINARY --out-dir $BROWSER_DIR --typescript --target web run_if_available wasm-opt $NODE_WASM -o $NODE_WASM -O diff --git a/flake.nix b/flake.nix index 0a9bf65322d..dc3b4881203 100644 --- a/flake.nix +++ b/flake.nix @@ -139,15 +139,13 @@ doCheck = false; }); - noir_wasm = craneLib.buildPackage (wasmConfig // rec { + noir_wasm = craneLib.buildPackage (wasmConfig // { pname = "noir_wasm"; inherit GIT_COMMIT GIT_DIRTY; cargoArtifacts = noir-wasm-cargo-artifacts; - cargoExtraArgs = "--package ${pname} --target wasm32-unknown-unknown"; - buildPhaseCargoCommand = '' bash compiler/wasm/buildPhaseCargoCommand.sh release '';