Skip to content

Commit

Permalink
fix: exporter and lint actions (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
dristpunk authored Jan 2, 2024
1 parent f64f742 commit c03042f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Export Interfaces And Contracts
name: Canary Release

on: [push]
on: workflow_dispatch

jobs:
export:
Expand All @@ -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
Expand All @@ -39,14 +41,14 @@ jobs:
uses: defi-wonderland/[email protected]
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 }}
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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.

0 comments on commit c03042f

Please sign in to comment.