Skip to content

Commit

Permalink
feat: added conditional to solidity exporter action
Browse files Browse the repository at this point in the history
* refactor: removed commented lines on pubish job

* refactor: updated readme with the current changes
  • Loading branch information
0xDiscotech committed Oct 27, 2023
1 parent aca86f7 commit 0f77c43
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/solidity-exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: [push]
jobs:
export:
name: Generate Interfaces And Contracts
if: false
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -42,9 +43,9 @@ jobs:
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 }}

- name: Publish to NPM - ${{ matrix.export_type }}
# 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 }}
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,37 @@ See the [Foundry Book for available options](https://book.getfoundry.sh/referenc

## Export And Publish

### Export
Export TypeScript interfaces from Solidity contracts and interfaces providing compatibility with TypeChain. Publish the exported packages to NPM.

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:
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
# Update package_name with your package name
package_name: "@defi_wonderland/solidity-exported"
```
solidity-exporter.yml

### Publish
jobs:
export:
name: Generate Interfaces And Contracts
if: true
...
```

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:
Also, remember to update the `package_name` param to your package name:

```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 }}
solidity-exporter.yml

- name: Export Solidity - ${{ matrix.export_type }}
uses: defi-wonderland/solidity-exporter-action@1dbf5371c260add4a354e7a8d3467e5d3b9580b8
with:
# Update package_name with your package name
package_name: "@defi_wonderland/solidity-exported"
...


- name: Publish to NPM - ${{ matrix.export_type }}
# Update `@defi_wonderland/solidity-exported` with your package name
run: cd export/@defi_wonderland/solidity-exported-${{ matrix.export_type }} && npm publish --access public
...
```

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

0 comments on commit 0f77c43

Please sign in to comment.