From 975de1fba6514a3628db1a3587120a32bd4f36bd Mon Sep 17 00:00:00 2001 From: 0xawaz Date: Mon, 23 Dec 2024 11:57:36 +0100 Subject: [PATCH 1/6] ci: chnage trigger to workflow_dispatch --- .github/workflows/fhevm-core-contracts-publish.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fhevm-core-contracts-publish.yml b/.github/workflows/fhevm-core-contracts-publish.yml index 756ecd0..04567ad 100644 --- a/.github/workflows/fhevm-core-contracts-publish.yml +++ b/.github/workflows/fhevm-core-contracts-publish.yml @@ -1,8 +1,13 @@ name: Publish fhEVM Solidity core contracts release on: - release: - types: [released] + workflow_dispatch: + inputs: + tag: + description: 'Release tag' + required: false + type: string + default: '' jobs: publish: @@ -24,5 +29,6 @@ jobs: - uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 with: package: ./contracts/package.json + tag: ${{ inputs.tag }} token: ${{ secrets.NPM_TOKEN }} provenance: true From b28b2f03b4d3b1a166f2707025003fab71a14d52 Mon Sep 17 00:00:00 2001 From: 0xawaz Date: Mon, 23 Dec 2024 12:10:19 +0100 Subject: [PATCH 2/6] ci: test new workflow --- .github/workflows/fhevm-core-contracts.yml | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/fhevm-core-contracts.yml diff --git a/.github/workflows/fhevm-core-contracts.yml b/.github/workflows/fhevm-core-contracts.yml new file mode 100644 index 0000000..bd25796 --- /dev/null +++ b/.github/workflows/fhevm-core-contracts.yml @@ -0,0 +1,34 @@ +name: test - Publish fhEVM Solidity core contracts + +on: + workflow_dispatch: + inputs: + tag: + description: 'Release tag' + required: true + type: string + default: '' + +jobs: + publish: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./contracts + permissions: + id-token: "write" + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - 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 + with: + package: ./contracts/package.json + tag: ${{ inputs.tag }} + token: ${{ secrets.NPM_TOKEN }} + provenance: true From a86fcd4f97968a33c93c16b7cf03d97bab274a80 Mon Sep 17 00:00:00 2001 From: 0xawaz Date: Mon, 23 Dec 2024 12:16:20 +0100 Subject: [PATCH 3/6] ci: remove inputs --- .github/workflows/fhevm-core-contracts-publish.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/fhevm-core-contracts-publish.yml b/.github/workflows/fhevm-core-contracts-publish.yml index 04567ad..e5e68a6 100644 --- a/.github/workflows/fhevm-core-contracts-publish.yml +++ b/.github/workflows/fhevm-core-contracts-publish.yml @@ -2,12 +2,6 @@ name: Publish fhEVM Solidity core contracts release on: workflow_dispatch: - inputs: - tag: - description: 'Release tag' - required: false - type: string - default: '' jobs: publish: @@ -29,6 +23,5 @@ jobs: - uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 with: package: ./contracts/package.json - tag: ${{ inputs.tag }} token: ${{ secrets.NPM_TOKEN }} provenance: true From 331e66450c95e499ad9eb6a8cbbc2b2f161594a1 Mon Sep 17 00:00:00 2001 From: 0xawaz Date: Mon, 23 Dec 2024 12:20:05 +0100 Subject: [PATCH 4/6] ci: add permissions --- .github/workflows/fhevm-core-contracts-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fhevm-core-contracts-publish.yml b/.github/workflows/fhevm-core-contracts-publish.yml index e5e68a6..e7052e7 100644 --- a/.github/workflows/fhevm-core-contracts-publish.yml +++ b/.github/workflows/fhevm-core-contracts-publish.yml @@ -10,7 +10,9 @@ jobs: run: working-directory: ./contracts permissions: - id-token: "write" + contents: read + id-token: write + packages: write steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 From ea34472d71a6cee4ee0d384a70dd4ef59f55b63c Mon Sep 17 00:00:00 2001 From: 0xawaz Date: Mon, 23 Dec 2024 12:50:19 +0100 Subject: [PATCH 5/6] 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 From d23b0130ad4a4a5f9ca9aa7986066b14c0ca31d8 Mon Sep 17 00:00:00 2001 From: 0xawaz Date: Mon, 23 Dec 2024 13:03:10 +0100 Subject: [PATCH 6/6] ci: fix inputs --- .../workflows/fhevm-core-contracts-publish.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/fhevm-core-contracts-publish.yml b/.github/workflows/fhevm-core-contracts-publish.yml index 6cd4076..901e9dc 100644 --- a/.github/workflows/fhevm-core-contracts-publish.yml +++ b/.github/workflows/fhevm-core-contracts-publish.yml @@ -3,8 +3,8 @@ name: Publish fhEVM Solidity core contracts release/prerelease on: workflow_dispatch: inputs: - prerelease: - description: "Set to true for prerelease tagging" + release: + description: "Set to true for release tagging" required: false default: false @@ -46,19 +46,19 @@ jobs: token: ${{ secrets.NPM_TOKEN }} provenance: true - - name: Publish to npm - if: ${{ inputs.prerelease != 'true' }} + - name: Publish prerelease to npm + if: ${{ inputs.release != 'true' }} uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 with: package: ./contracts/package.json + tag: prerelease token: ${{ secrets.NPM_TOKEN }} provenance: true - - name: Publish prerelease to npm - if: ${{ inputs.prerelease == 'true' }} + - name: Publish release to npm + if: ${{ inputs.release == 'true' }} uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 with: package: ./contracts/package.json - tag: prerelease token: ${{ secrets.NPM_TOKEN }} - provenance: true + provenance: true \ No newline at end of file