From ea34472d71a6cee4ee0d384a70dd4ef59f55b63c Mon Sep 17 00:00:00 2001 From: 0xawaz Date: Mon, 23 Dec 2024 12:50:19 +0100 Subject: [PATCH] ci: merge release and prerelease workflows --- .../fhevm-core-contracts-publish.yml | 51 ++++++++++++++++--- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/.github/workflows/fhevm-core-contracts-publish.yml b/.github/workflows/fhevm-core-contracts-publish.yml index e7052e7..6cd4076 100644 --- a/.github/workflows/fhevm-core-contracts-publish.yml +++ b/.github/workflows/fhevm-core-contracts-publish.yml @@ -1,7 +1,12 @@ -name: Publish fhEVM Solidity core contracts release +name: Publish fhEVM Solidity core contracts release/prerelease on: workflow_dispatch: + inputs: + prerelease: + description: "Set to true for prerelease tagging" + required: false + default: false jobs: publish: @@ -14,16 +19,46 @@ jobs: id-token: write packages: write steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - name: Check out repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + + - name: Set up Node.js + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: 20.x - - run: cp .env.example.deployment .env - - run: npm ci --include=optional - - run: npm run compile - - run: npm run compile:gateway - - uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 + + - name: Prepare environment file + run: cp .env.example.deployment .env + + - name: Install dependencies + run: npm ci --include=optional + + - name: Compile contracts + run: npm run compile + + - name: Compile gateway + run: npm run compile:gateway + + - name: Publish to npm + uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 + with: + package: ./contracts/package.json + token: ${{ secrets.NPM_TOKEN }} + provenance: true + + - name: Publish to npm + if: ${{ inputs.prerelease != 'true' }} + uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 + with: + package: ./contracts/package.json + token: ${{ secrets.NPM_TOKEN }} + provenance: true + + - name: Publish prerelease to npm + if: ${{ inputs.prerelease == 'true' }} + uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 with: package: ./contracts/package.json + tag: prerelease token: ${{ secrets.NPM_TOKEN }} provenance: true