-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated chain configs to be indexed by property * updated wagmi addresses * added release pr * added changeset config * added minor patch * fix branch name * added missing changeset cli * switching to pnpm * convert to npm install since yarn gives issues * Remove changes that are not relevant to this PR * changed to main * added publish step * minor fix * clearing yarn.lock * added developming documentaiton * Added deployment workflow diagram, way to generate image, and output of image in the docs * undo chain config changes to make PR just about changesets * remove file not used * updated readme * slightly updated doc * fix bundled changed configs to be like it was before * Added changeset
- Loading branch information
Showing
12 changed files
with
1,894 additions
and
96 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'yarn' | ||
|
||
- name: Install project dependencies | ||
run: yarn | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
# This expects you to have a script called release which does a build for your packages and calls changeset publish | ||
publish: yarn release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js 16 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Create Release Pull Request | ||
uses: changesets/action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Developer Workflow | ||
|
||
## Deploying to a new chain | ||
|
||
1. Setup new `chainConfigs` file setting 1. fee recipient, and 2. owner for factory contracts | ||
2. Run forge/foundry deploy script | ||
3. Update deployed addresses file `yarn run update-new-deployment-addresses` | ||
4. Verify `addresses/CHAINID.json` exists. | ||
5. Ensure contracts are verified on block explorer. | ||
7. Add a changeset with `npx changeset` | ||
6. Make PR with new addresses json files and changeset. | ||
|
||
# Whats bundled in the published package | ||
|
||
* `/package/wagmiGenerated.ts` - smart contract abis and deployment addresses | ||
* `./package/chainConfigs.ts` - configuration of smart contracts by chainId | ||
|
||
# Publishing the package; Generating changesets, versioning, building and Publishing. | ||
|
||
Diagram of the deploying + publishing workflow: | ||
![Deploying & Publishing Workflow](uml/generated/deployment.svg) | ||
|
||
Publishing happens in the following steps: | ||
|
||
* Some changes are made to the repo; this can include smart contract changes or additions, if smart contracts are changed, tests should be created or updated to reflect the changes. | ||
* The changes are committed to a branch which is **pushed** to **github**. | ||
* A **pr** is **opened** for this branch. | ||
* The changes are reviewed, if they are **approved**: | ||
* *If there are changes to the smart contracts that should be deployed*: the contract should be. Deploying the contract results in the addresses of the deployed contracts being updated in the corresponding `./addresses/{chainId}.json` file. This file should be committed and pushed to github. | ||
* Running the command `npx changeset` will generate **a new changeset** in the `./changesets` directory. This changeset will be used to determine the next version of the bundled packages; this commit should then be pushed. | ||
* The changeset and smart contract addresses are pushed to the branch. | ||
* The pr is merged into main - any changesets in the PR are detected by a github action `release`, which will then **open a new PR** with proper the versions and readme updated in each each package. If more changesets are pushed to main before this branch is merged, the PR will continuously update the version of the packages according to the changeset specifiction. | ||
|
||
7. That version is merged into main along with the new versions. | ||
|
||
8. The package is the published to npm with the command: `yarn publish-packages` and the package is published. | ||
|
||
In a future version, the when the version branch is merged into main, it can publish the new repos to github. | ||
|
||
Some active questions: | ||
|
||
* How do we ensure the contract version matches the package version? Or does it need to match? Sometimes there is a js package update without a smart contract update. | ||
|
||
Future ideas: | ||
|
||
* Allow deployment to happen via github actions: | ||
* Deployments can be added to changesets through some command. If a changeset is pushed to main and a deployment is detected in it, a deployment task is added to the PR that's created. When that PR is merged, the deployment happens, and a new package is built and publised to npm with the new versions. |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@startuml | ||
actor Developer | ||
actor AnotherDeveloper | ||
actor Reviewer | ||
entity LocalBranch | ||
entity RemotePR | ||
entity main | ||
participant ReleaseGithubAction | ||
entity VersionPackagesPR | ||
participant blockchain | ||
participant npm | ||
|
||
Activate LocalBranch | ||
Developer -> LocalBranch: Change smart contracts \nand commit | ||
Developer -> LocalBranch: npx changeset - create a changeset \n& commit | ||
Developer -> LocalBranch: Git push & open PR | ||
LocalBranch --> RemotePR: Deltas and changeset | ||
activate RemotePR | ||
Reviewer -> RemotePR: Approve PR | ||
Developer -> LocalBranch: Deploy to all chains | ||
LocalBranch --> blockchain: Updated or new smart contracts | ||
LocalBranch --> LocalBranch: Update addresses json files | ||
Developer -> LocalBranch: push updated addresses json files | ||
LocalBranch --> RemotePR: Updated addresses json files | ||
deactivate LocalBranch | ||
Developer -> RemotePR: Merge to main | ||
RemotePR --> main: Code Deltas + Changesets + \nUpdated addresses | ||
deactivate RemotePR | ||
activate main | ||
main --> ReleaseGithubAction: Changes to main \nincluding changeset | ||
deactivate main | ||
ReleaseGithubAction -> VersionPackagesPR: Create a PR with new versions \napplied to package.jsons from \ninstrucitons in new changesets | ||
activate VersionPackagesPR | ||
AnotherDeveloper -> main: Push a new changeset | ||
activate main | ||
main --> ReleaseGithubAction: new changeset | ||
deactivate main | ||
ReleaseGithubAction -> VersionPackagesPR: Update PR with new versions \napplied to package.jsons from \ninstrucitons in new changests | ||
Developer -> VersionPackagesPR: merge to main | ||
VersionPackagesPR --> main: Updated versions in packages. | ||
deactivate VersionPackagesPR | ||
activate main | ||
main -> ReleaseGithubAction: new versions in package.jsons | ||
ReleaseGithubAction -> npm: Build and publish packages | ||
deactivate main | ||
activate npm | ||
|
||
@enduml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
# converts all puml files to svg | ||
# requires Docker to be installed and running | ||
|
||
BASEDIR=$(dirname "$0") | ||
# create output dir env var which is basedir/generated: | ||
OUTPUT_DIR=$BASEDIR/generated | ||
mkdir -p $OUTPUT_DIR | ||
for FILE in $BASEDIR/*.puml; do | ||
echo Converting $FILE.. | ||
FILE_SVG=${FILE//puml/svg} | ||
cat $FILE | docker run --rm -i think/plantuml > $FILE_SVG | ||
docker run --rm -v $PWD:/diagrams productionwentdown/ubuntu-inkscape inkscape /diagrams/$FILE_SVG --export-area-page --without-gui &> /dev/null | ||
done | ||
mv $BASEDIR/*.svg $OUTPUT_DIR | ||
echo Done |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.