chore: add bulla-registry dispatch notification to release CI #80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| FOUNDRY_PROFILE: ci | |
| jobs: | |
| test: | |
| name: "Test Before Release 🧪" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: v1.2.3 | |
| - name: Install forge dependencies | |
| run: forge install | |
| - name: Run forge build | |
| run: | | |
| forge --version | |
| forge build --sizes | |
| id: build | |
| - name: Run tests | |
| run: forge test --gas-report | |
| - name: Generate coverage report | |
| run: | | |
| forge coverage --report lcov | |
| # Filter out mocks and test files from coverage | |
| node -e " | |
| const fs = require('fs'); | |
| const data = fs.readFileSync('lcov.info','utf8'); | |
| fs.writeFileSync('lcov.info', | |
| data.split('\n') | |
| .filter(line => !line.includes('SF:src/mocks/')) | |
| .filter(line => !line.includes('SF:test/')) | |
| .join('\n') | |
| ); | |
| " | |
| release: | |
| name: "Semantic Release 🚀" | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'bulla-network/bulla-contracts-V2' && github.event_name == 'push' | |
| steps: | |
| - name: Generate GitHub App Token | |
| id: generate-token | |
| uses: tibdex/github-app-token@v1 | |
| with: | |
| app_id: ${{ secrets.APP_ID }} | |
| private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| cache: "yarn" | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: v1.2.3 | |
| - name: Install forge dependencies | |
| run: forge install | |
| - name: Install yarn dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build contracts | |
| run: forge build | |
| - name: Generate TypeChain types | |
| run: yarn typechain | |
| - name: Verify package can be packed | |
| run: yarn pack --dry-run | |
| - name: Release | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npx semantic-release | |
| - name: Notify bulla-registry | |
| if: success() | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: Bearer ${{ secrets.REGISTRY_DISPATCH_TOKEN }}" \ | |
| https://api.github.com/repos/bulla-network/bulla-registry/dispatches \ | |
| -d '{"event_type":"source-updated","client_payload":{"repo":"${{ github.repository }}"}}' |