Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leveraging changesets for versioning and publishing #119

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
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)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
40 changes: 40 additions & 0 deletions .github/workflows/changesets.yml
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 }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ cache
dist/
out/
.idea
broadcast/
broadcast/
package/wagmiGenerated.ts
package/chainConfigs.ts
17 changes: 13 additions & 4 deletions DEPLOYING.md → DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Deploying to a new chain
# Development/Deploying workflow

## Development workflow

1. Open a PR with changes
2. Run `npx changeset` to generate a new changeset
3. If changes are approved and merged, a github action will open a PR "Version Packages" and create a corresponding branch `changeset-release/changeset`
4. If a deployment of the contracts should to be done that would affect the deployed contract addresses, checkout the branch `changeset-release/changeset`,
*follow the deployment steps below,* commit changes, and push that branch, which will contain the updated deployed addresses.
5. Merge the PR "Version Packages" to master, which will trigger a github action to publish the new packages to npm.

## Deploying to a new chain

### 1. Setup `chainConfigs` file.

Expand Down Expand Up @@ -38,6 +49,4 @@ Use your own RPC configuration variables

Copies new addresses over to `addresses` folder:

node js-scripts/copy-latest-deployment-addresses.mjs deploy

### 4. Update node
node js-scripts/copy-latest-deployment-addresses.mjs deploy
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
"coverage": "forge coverage --report lcov",
"build": "forge build",
"build-ts": "tsup package/index.ts --format cjs --dts --sourcemap",
"bundle-configs": "node js-scripts/bundle-chainConfigs.mjs && yarn format",
"bundle-configs": "node js-scripts/bundle-chainConfigs.mjs",
"prettier": "npx prettier \"js-scripts/**/*.mjs\" \"package/**/*.ts\" \"wagmi.config.ts\" --check",
"prettier:fix": "npm run prettier -- --write",
"wagmi": "wagmi generate",
"storage-inspect:check": "./script/storage-check.sh check ERC721Drop ERC721DropProxy FactoryUpgradeGate ZoraNFTCreatorProxy ZoraNFTCreatorV1",
"storage-inspect:generate": "./script/storage-check.sh generate ERC721Drop ERC721DropProxy FactoryUpgradeGate ZoraNFTCreatorProxy ZoraNFTCreatorV1"
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/address": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
Expand Down
68 changes: 0 additions & 68 deletions package/chainConfigs.ts

This file was deleted.

4 changes: 3 additions & 1 deletion package/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './wagmiGenerated';
export { chainConfigs } from './chainConfigs';
import { chainConfigs } from './chainConfigs';

export { chainConfigs as chainConfigs };
Loading
Loading