Skip to content
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
16 changes: 2 additions & 14 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ git push upstream vX.Y.Z-rc.R

Draft the release notes in our [GitHub releases](https://github.com/OpenZeppelin/openzeppelin-solidity/releases). Make sure to mark it as a pre-release! Try to be consistent with our previous release notes in the title and format of the text. Release candidates don't need a detailed changelog, but make sure to include a link to GitHub's compare page.

Before publishing on npm you need to generate the build artifacts. This is not done automatically at the moment because of a bug in Truffle. Since some of the contracts should not be included in the package, this is a _hairy_ process that you need to do with care.

1. Delete the `contracts/mocks`, `contracts/examples` and `build` directories.
2. Run `truffle compile`. (Note that the Truffle process may never exit and you will have to interrupt it.)
3. Recover the directories using `git checkout`. It doesn't matter if you do this now or later.

Once the CI run for the new tag is green, publish on npm under the `next` tag.
Once the CI run for the new tag is green, publish on npm under the `next` tag. You should see the contracts compile automatically.

```
npm publish --tag next
Expand Down Expand Up @@ -68,13 +62,7 @@ git push upstream vX.Y.Z

Draft the release notes in GitHub releases. Try to be consistent with our previous release notes in the title and format of the text. Make sure to include a detailed changelog.

Before publishing on npm you need to generate the build artifacts. This is not done automatically at the moment because of a bug in Truffle. Since some of the contracts should not be included in the package, this is a _hairy_ process that you need to do with care.

1. Delete the `contracts/mocks`, `contracts/examples` and `build` directories.
2. Run `truffle compile`. (Note that the Truffle process may never exit and you will have to interrupt it.)
3. Recover the directories using `git checkout`. It doesn't matter if you do this now or later.

Once the CI run for the new tag is green, publish on npm.
Once the CI run for the new tag is green, publish on npm. You should see the contracts compile automatically.

```
npm publish
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"lint:fix": "npm run lint:js:fix && npm run lint:sol:fix",
"console": "truffle console",
"coverage": "scripts/coverage.sh",
"version": "scripts/version.js"
"version": "scripts/version.js",
"build": "scripts/build.sh",
"prepack": "npm run build"
},
"repository": {
"type": "git",
Expand Down
25 changes: 25 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# Configure to exit script as soon as a command fails.
set -o errexit

# Clean the existing build directory.
rm -rf build

# Create a temporary directory to place ignored files (e.g. examples).
tmp_dir="$(mktemp -dp.)"

# Move the ignored files to the temporary directory.
while IFS="" read -r ignored
do
mv "contracts/$ignored" "$tmp_dir"
done < contracts/.npmignore

# Compile everything else.
node_modules/.bin/truffle compile

# Return ignored files to their place.
mv "$tmp_dir/"* contracts/

# Delete the temporary directory.
rmdir "$tmp_dir"