Last active
February 14, 2023 11:55
-
-
Save dalechyn/0b781eadc7c14985b757e373bba330b5 to your computer and use it in GitHub Desktop.
Everything you need for your Foundry repository to generate sdk package with @wagmi/cli + docs as the bonus
This file contains 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
# Workflow for deploying the `forge doc` site to GitHub Pages | |
name: Docs | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
# In the GitHub Actions Marketplace template, we can use $default-branch | |
# However, $default-branch functions in templates but not in workflows | |
# branches: [ $default-branch ] | |
# Therefore, if you're using this GitHub Action directly, you need to add | |
# branches below | |
# Add branch names that you want to run the Action on here | |
branches: [main, master] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Foundry | |
uses: onbjerg/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Install dependencies | |
run: forge install | |
- name: Generate docs | |
run: forge doc --build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload generated book directory | |
path: ./docs/book | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |
This file contains 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": "your-contracts-sdk-package-name", | |
"version": "1.0.0", | |
"main": "dist/generated.ts", | |
"type": "module", | |
"devDependencies": { | |
"@semantic-release/changelog": "^6.0.2", | |
"@semantic-release/commit-analyzer": "^9.0.2", | |
"@semantic-release/git": "^10.0.1", | |
"@semantic-release/github": "^8.0.7", | |
"@semantic-release/npm": "^9.0.2", | |
"@semantic-release/release-notes-generator": "^10.0.3", | |
"semantic-release": "^19.0.5", | |
"typescript": "^4.9.5" | |
}, | |
"publishConfig": { | |
"access": "public" | |
} | |
} |
This file contains 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
module.exports = { | |
branches: ['main'], | |
plugins: [ | |
'@semantic-release/commit-analyzer', | |
'@semantic-release/release-notes-generator', | |
'@semantic-release/changelog', | |
'@semantic-release/npm', | |
[ | |
'@semantic-release/git', | |
{ | |
assets: ['package.json', 'README.md', 'CHANGELOG.md'], | |
message: | |
'chore(release): ${nextRelease.version}\n\n${nextRelease.notes}' | |
} | |
], | |
'@semantic-release/github' | |
] | |
} |
This file contains 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: 🧹 Lint, 🧪 Test, 🚀 Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
lint-and-test: | |
name: 🧹 Lint & 🧪 Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: onbjerg/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Run lint check | |
run: forge fmt --check | |
- name: Run tests | |
run: forge test | |
release: | |
name: 🚀 Release | |
needs: lint-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🧲 | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
token: ${{ secrets.SEMANTIC_RELEASE_PAT }} | |
submodules: recursive | |
- name: Install dependencies 📦 | |
run: yarn install | |
- name: Install Foundry | |
uses: onbjerg/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Generate SDK 🪛 | |
run: yarn wagmi generate | |
- name: Release 🪄🎁 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_PAT }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: yarn semantic-release |
This file contains 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
// @ts-check | |
import { foundry, react } from "@wagmi/cli/plugins"; | |
/** @type {import('@wagmi/cli').Config} */ | |
export default { | |
out: "dist/generated.ts", | |
contracts: [], | |
plugins: [ | |
foundry({ | |
project: ".", | |
}), | |
react() | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment