Skip to content

Commit

Permalink
feat: npm exporter action
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOneTony committed Oct 18, 2024
1 parent d39e157 commit ad7e533
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on: [push]

jobs:
release:
name: Release

runs-on: ubuntu-latest
strategy:
matrix:
export_type: ['interfaces', 'all']

env:
PROJECT_NAME: '@allo-protocol/allo-v2.1'
EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }}

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup bun env
uses: oven-sh/setup-bun@v1

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

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

- name: Install dependencies
run: bun install

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

- name: Export Solidity - Export Type ${{ matrix.export_type }}
uses: defi-wonderland/[email protected]
with:
package_name: ${{ env.PROJECT_NAME }}
out: 'out'
interfaces: 'contracts/core/interfaces'
contracts: 'contracts/core'
libraries: "contracts/core/libraries"
export_type: '${{ matrix.export_type }}'

- name: Publish to NPM
run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"private": true,
"scripts": {
"compile": "forge compile",
"build": "forge build",
"build": "bun run smock && forge build",
"test": "forge test",
"fmt": "forge fmt contracts/**/*.sol && forge fmt test/**/*.sol",
"lint:sol": "solhint -c .solhint.json 'contracts/**/*.sol'",
Expand Down

0 comments on commit ad7e533

Please sign in to comment.