From e04c95966264a100d305a2f8c7c9d8d28f098e3d Mon Sep 17 00:00:00 2001 From: dante <45801863+alexander-camuto@users.noreply.github.com> Date: Fri, 31 May 2024 08:34:51 -0400 Subject: [PATCH] fix: sequential dependence between JS releases (#806) --- .github/workflows/engine.yml | 55 +++++++++++++++++++++++++++++ .github/workflows/verify.yml | 68 ------------------------------------ 2 files changed, 55 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/verify.yml diff --git a/.github/workflows/engine.yml b/.github/workflows/engine.yml index 07972bfaa..60c2906fc 100644 --- a/.github/workflows/engine.yml +++ b/.github/workflows/engine.yml @@ -178,3 +178,58 @@ jobs: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + + in-browser-evm-ver-publish: + name: publish-in-browser-evm-verifier-package + needs: [publish-wasm-bindings] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v4 + - name: Update version in package.json + shell: bash + env: + RELEASE_TAG: ${{ github.ref_name }} + run: | + sed -i "s|\"version\": \".*\"|\"version\": \"${{ github.ref_name }}\"|" in-browser-evm-verifier/package.json + - name: Prepare tag and fetch package integrity + run: | + CLEANED_TAG=${{ github.ref_name }} # Get the tag from ref_name + CLEANED_TAG="${CLEANED_TAG#v}" # Remove leading 'v' + echo "CLEANED_TAG=${CLEANED_TAG}" >> $GITHUB_ENV # Set it as an environment variable for later steps + ENGINE_INTEGRITY=$(npm view @ezkljs/engine@$CLEANED_TAG dist.integrity) + echo "ENGINE_INTEGRITY=$ENGINE_INTEGRITY" >> $GITHUB_ENV + - name: Update @ezkljs/engine version in package.json + shell: bash + env: + RELEASE_TAG: ${{ github.ref_name }} + run: | + sed -i "s|\"@ezkljs/engine\": \".*\"|\"@ezkljs/engine\": \"$CLEANED_TAG\"|" in-browser-evm-verifier/package.json + - name: Update the engine import in in-browser-evm-verifier to use @ezkljs/engine package instead of the local one; + run: | + sed -i "s|import { encodeVerifierCalldata } from '../nodejs/ezkl';|import { encodeVerifierCalldata } from '@ezkljs/engine';|" in-browser-evm-verifier/src/index.ts + - name: Update pnpm-lock.yaml versions and integrity + run: | + awk -v integrity="$ENGINE_INTEGRITY" -v tag="$CLEANED_TAG" ' + NR==30{$0=" specifier: \"" tag "\""} + NR==31{$0=" version: \"" tag "\""} + NR==400{$0=" /@ezkljs/engine@" tag ":"} + NR==401{$0=" resolution: {integrity: \"" integrity "\"}"} 1' in-browser-evm-verifier/pnpm-lock.yaml > temp.yaml && mv temp.yaml in-browser-evm-verifier/pnpm-lock.yaml + - name: Use pnpm 8 + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.12.1" + registry-url: "https://registry.npmjs.org" + - name: Publish to npm + run: | + cd in-browser-evm-verifier + pnpm install --frozen-lockfile + pnpm run build + pnpm publish --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml deleted file mode 100644 index 662b1b4d4..000000000 --- a/.github/workflows/verify.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Build and Publish EZKL npm packages (wasm bindings and in-browser evm verifier) - -on: - workflow_dispatch: - inputs: - tag: - description: "The tag to release" - required: true - push: - tags: - - "*" - -defaults: - run: - working-directory: . -jobs: - in-browser-evm-ver-publish: - name: publish-in-browser-evm-verifier-package - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - steps: - - uses: actions/checkout@v4 - - name: Update version in package.json - shell: bash - env: - RELEASE_TAG: ${{ github.ref_name }} - run: | - sed -i "s|\"version\": \".*\"|\"version\": \"${{ github.ref_name }}\"|" in-browser-evm-verifier/package.json - - name: Prepare tag and fetch package integrity - run: | - CLEANED_TAG=${{ github.ref_name }} # Get the tag from ref_name - CLEANED_TAG="${CLEANED_TAG#v}" # Remove leading 'v' - echo "CLEANED_TAG=${CLEANED_TAG}" >> $GITHUB_ENV # Set it as an environment variable for later steps - ENGINE_INTEGRITY=$(npm view @ezkljs/engine@$CLEANED_TAG dist.integrity) - echo "ENGINE_INTEGRITY=$ENGINE_INTEGRITY" >> $GITHUB_ENV - - name: Update @ezkljs/engine version in package.json - shell: bash - env: - RELEASE_TAG: ${{ github.ref_name }} - run: | - sed -i "s|\"@ezkljs/engine\": \".*\"|\"@ezkljs/engine\": \"$CLEANED_TAG\"|" in-browser-evm-verifier/package.json - - name: Update the engine import in in-browser-evm-verifier to use @ezkljs/engine package instead of the local one; - run: | - sed -i "s|import { encodeVerifierCalldata } from '../nodejs/ezkl';|import { encodeVerifierCalldata } from '@ezkljs/engine';|" in-browser-evm-verifier/src/index.ts - - name: Update pnpm-lock.yaml versions and integrity - run: | - awk -v integrity="$ENGINE_INTEGRITY" -v tag="$CLEANED_TAG" ' - NR==30{$0=" specifier: \"" tag "\""} - NR==31{$0=" version: \"" tag "\""} - NR==400{$0=" /@ezkljs/engine@" tag ":"} - NR==401{$0=" resolution: {integrity: \"" integrity "\"}"} 1' in-browser-evm-verifier/pnpm-lock.yaml > temp.yaml && mv temp.yaml in-browser-evm-verifier/pnpm-lock.yaml - - name: Use pnpm 8 - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.12.1" - registry-url: "https://registry.npmjs.org" - - name: Publish to npm - run: | - cd in-browser-evm-verifier - pnpm install --frozen-lockfile - pnpm run build - pnpm publish --no-git-checks - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file