Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added solidity exporter action yml file #31

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/solidity-exporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Export Interfaces And Contracts

on: [push]

jobs:
export:
name: Generate Interfaces And Contracts
runs-on: ubuntu-latest
0xGorilla marked this conversation as resolved.
Show resolved Hide resolved
strategy:
matrix:
export_type: ["interfaces", "contracts"]

steps:
- uses: actions/checkout@v3

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build project and generate out directory
run: yarn build

- name: Update version
run: yarn version --new-version "0.0.0-${GITHUB_SHA::8}" --no-git-tag-version

- name: Export Solidity - ${{ matrix.export_type }}
uses: defi-wonderland/solidity-exporter-action@1dbf5371c260add4a354e7a8d3467e5d3b9580b8
0xDiscotech marked this conversation as resolved.
Show resolved Hide resolved
with:
# Update package_name with your package name
package_name: "@defi_wonderland/solidity-exported"
0xGorilla marked this conversation as resolved.
Show resolved Hide resolved
out: "out"
interfaces: "solidity/interfaces"
contracts: "solidity/contracts"
export_type: "${{ matrix.export_type }}"
## Uncomment it if you want to publish your exported packages to NPM
# - name: Publish
## Update `@defi_wonderland/solidity-exported` with your package name
# run: cd export/@defi_wonderland/solidity-exported-${{ matrix.export_type }} && npm publish --access public
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<dt>Github workflows CI</dt>
<dd>Run all tests and see the coverage as you push your changes.</dd>
<dd>Export your Solidity interfaces and contracts as packages, and publish them to NPM.</dd>
</dl>

## Setup
Expand Down Expand Up @@ -105,3 +106,31 @@ yarn deploy:mainnet
The deployments are stored in ./broadcast

See the [Foundry Book for available options](https://book.getfoundry.sh/reference/forge/forge-create.html).

## Export And Publish

### Export

Export TypeScript interfaces from Solidity contracts and interfaces providing compatibility with TypeChain.

Update the `package_name` in the `solidity-exporter.yml` file to match your package name:

```yaml
# Update package_name with your package name
package_name: "@defi_wonderland/solidity-exported"
```

### Publish

If you want to publish the exported packages to NPM, you can do so by uncommenting the following lines in the `solidity-exporter.yml` file (make sure you've set the `NPM_TOKEN` on your org's secrets) and updating the package name with yours:
0xGorilla marked this conversation as resolved.
Show resolved Hide resolved

```yaml
## Uncomment it if you want to publish your exported packages to NPM
# - name: Publish
## Update `@defi_wonderland/solidity-exported` with your package name
# run: cd export/@defi_wonderland/solidity-exported-${{ matrix.export_type }} && npm publish --access public
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```

You can take a look at our [solidity-exporter-action](https://github.com/defi-wonderland/solidity-exporter-action) repository more information and usage examples.
Loading
Loading