From c03042fc53ce6dd6e1e56e98c9d78883c93ee7c7 Mon Sep 17 00:00:00 2001 From: dristpunk <107591874+dristpunk@users.noreply.github.com> Date: Tue, 2 Jan 2024 13:29:23 +0300 Subject: [PATCH] fix: exporter and lint actions (#41) --- .../{solidity-exporter.yml => canary.yml} | 30 ++++++----- .github/workflows/release.yml | 53 +++++++++++++++++++ README.md | 6 +-- 3 files changed, 70 insertions(+), 19 deletions(-) rename .github/workflows/{solidity-exporter.yml => canary.yml} (65%) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/solidity-exporter.yml b/.github/workflows/canary.yml similarity index 65% rename from .github/workflows/solidity-exporter.yml rename to .github/workflows/canary.yml index 54eeef67..1ff69d3d 100644 --- a/.github/workflows/solidity-exporter.yml +++ b/.github/workflows/canary.yml @@ -1,6 +1,6 @@ -name: Export Interfaces And Contracts +name: Canary Release -on: [push] +on: workflow_dispatch jobs: export: @@ -10,21 +10,23 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - export_type: ["interfaces", "contracts"] + export_type: ['interfaces', 'contracts'] steps: - - uses: actions/checkout@v3 + - name: Checkout Repo + uses: actions/checkout@v4 - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: version: nightly - - name: Use Node.js - uses: actions/setup-node@v3 + - name: Install Node + uses: actions/setup-node@v4 with: - node-version: 16 - registry-url: "https://registry.npmjs.org" + registry-url: 'https://registry.npmjs.org' + node-version: 18.x + cache: 'yarn' - name: Install dependencies run: yarn --frozen-lockfile @@ -39,14 +41,14 @@ jobs: uses: defi-wonderland/solidity-exporter-action@v2.0.0 with: # Update package_name with your package name - package_name: "my-cool-project" - out: "out" - interfaces: "solidity/interfaces" - contracts: "solidity/contracts" - export_type: "${{ matrix.export_type }}" + package_name: 'my-cool-project' + out: 'out' + interfaces: 'solidity/interfaces' + contracts: 'solidity/contracts' + export_type: '${{ matrix.export_type }}' - name: Publish to NPM - ${{ matrix.export_type }} # Update `my-cool-project` with your package name - run: cd export/my-cool-project-${{ matrix.export_type }} && npm publish --access public + run: cd export/my-cool-project-${{ matrix.export_type }} && npm publish --access public --tag canary env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8a35614f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Production Release + +on: + release: + types: [published] + +jobs: + release: + name: Release + # Remove the following line if you wish to export your Solidity contracts and interfaces and publish them to NPM + if: false + runs-on: ubuntu-latest + strategy: + matrix: + export_type: ['interfaces', 'contracts'] + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Install Node + uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + node-version: 18.x + cache: 'yarn' + + - name: Install dependencies + run: yarn --frozen-lockfile + + - name: Build project and generate out directory + run: yarn build + + - name: Export Solidity - ${{ matrix.export_type }} + uses: defi-wonderland/solidity-exporter-action@v2.0.0 + with: + # Update package_name with your package name + package_name: 'my-cool-project' + out: 'out' + interfaces: 'solidity/interfaces' + contracts: 'solidity/contracts' + export_type: '${{ matrix.export_type }}' + + - name: Publish to NPM - ${{ matrix.export_type }} + # Update `my-cool-project` with your package name + run: cd export/my-cool-project-${{ matrix.export_type }} && npm publish --access public --tag latest + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 4254e93f..903f1fb7 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,6 @@ Export TypeScript interfaces from Solidity contracts and interfaces providing co To enable this feature, make sure you've set the `NPM_TOKEN` on your org's secrets. Then set the job's conditional to `true`: ```yaml -solidity-exporter.yml - jobs: export: name: Generate Interfaces And Contracts @@ -127,8 +125,6 @@ jobs: Also, remember to update the `package_name` param to your package name: ```yaml -solidity-exporter.yml - - name: Export Solidity - ${{ matrix.export_type }} uses: defi-wonderland/solidity-exporter-action@1dbf5371c260add4a354e7a8d3467e5d3b9580b8 with: @@ -143,4 +139,4 @@ solidity-exporter.yml ... ``` -You can take a look at our [solidity-exporter-action](https://github.com/defi-wonderland/solidity-exporter-action) repository more information and usage examples. +You can take a look at our [solidity-exporter-action](https://github.com/defi-wonderland/solidity-exporter-action) repository for more information and usage examples.