Skip to content

Commit

Permalink
chore(release): fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed Feb 4, 2019
1 parent eae7398 commit 27a3b9f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
26 changes: 14 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,17 @@ Our release process generates the following packages:
* An executable for OSX, Linux, and Windows, generated by [Pkg](https://github.com/zeit/pkg) and hosted on our [Github page](https://github.com/garden-io/garden/releases).
* A [Homebrew](https://brew.sh/) package for OSX users.

To make a new release, set your current working directory to the garden root directory and follow the steps below. The examples assume we're creating a release for `0.8.0-rc2`:

1. Checkout out to a new release branch: `git checkout -b release-0.8.0-rc2`.
2. Run the release script: `./bin/release 0.8.0-rc2`. This will update the version, generate the changelog, create a tag for the version, and push the tag to Github. Pushing the tag triggers a CI process which creates the release artifacts.
3. Open the [Garden project on CircleCI](https://circleci.com/gh/garden-io/garden) and browse to the job marked `release-service-pkg`. Open the **Artifacts** tab and download the listed artifacts.
4. Go to our Github [Releases tab](https://github.com/garden-io/garden/releases) and click the **Draft a new release** button.
5. Fill in the **Tag version** and **Release title** fields with the new release version (same as you used for the tag).
6. Upload the downloaded artifacts.
7. Write release notes (not necessary for RCs). The notes should _at least_ contain the changelog.
8. Click the **Publish release** button.
9. Push the branch and make a pull request.
10. If you're making an RC, you're done! Otherwise, you need to update Homebrew package: `gulp update-brew`.
To make a new release, set your current working directory to the garden root directory and follow the steps below.

1. Run the release script: `./bin/release <version>`. The script does the following:
* Checks out a branch named `release-<version>`.
* Updates `package.json` and `package-lock.json` for `garden-service` and the changelog.
* Commits the changes, tags the commit and pushes the tag, triggering a CI process the creates the release artifacts.
2. Open the [Garden project on CircleCI](https://circleci.com/gh/garden-io/garden) and browse to the job marked `release-service-pkg`. Open the **Artifacts** tab and download the listed artifacts.
3. Go to our Github [Releases tab](https://github.com/garden-io/garden/releases) and click the **Draft a new release** button.
4. Fill in the **Tag version** and **Release title** fields with the new release version (same as you used for the tag).
5. Upload the downloaded artifacts.
6. Write release notes (not necessary for RCs). The notes should _at least_ contain the changelog.
7. Click the **Publish release** button.
8. Push the branch and make a pull request.
9. If you're making an RC, you're done! Otherwise, you need to update Homebrew package: `gulp update-brew`.
39 changes: 23 additions & 16 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ set -eo pipefail

# Performs the following steps to prepare for a release:
#
# 1. Updates the version field in garden-service/package.json.
# 2. Updates garden-service/package-lock.json by doing npm install.
# 3. Creates a tag for the version (we need this for the changelog).
# 4. Generates the changelog, based on the tag from the previous step. TODO: Use --next-tag flag when no longer experimental
# 1. Checks out to a branch named release-${version}
# 2. Updates the version field in garden-service/package.json.
# 3. Updates garden-service/package-lock.json by doing npm install.
# 4. Creates a tag for the version (we need this for the changelog).
# 5. Generates the changelog, based on the tag from the previous step. TODO: Use --next-tag flag when no longer experimental
# and skip step 3.
# 5. Adds and commits CHANGELOG.md, garden-service/package.json and garden-service/package-lock.json
# 6. Updates the tag after the commit
# 7. Pushes the tag. This triggers CircleCI process that creates the release artifacts
# 6. Adds and commits CHANGELOG.md, garden-service/package.json and garden-service/package-lock.json
# 7. Updates the tag after the commit
# 8. Pushes the tag. This triggers CircleCI process that creates the release artifacts

# Bumps garden-service/package.json version. Adapted from here: https://gist.github.com/timseverien/5c1ba6548df32ca3a16b
function bump {
Expand All @@ -28,33 +29,39 @@ function release {
Preparing to release version ${version}...
"

# Updating garden-service/package.json version
# Checkout out to a dedicated release branch
git checkout -b release-${version}

# Update garden-service/package.json version
bump ${version}

# Updating package-lock.json version
# Update package-lock.json version
cd garden-service && npm install && cd ..

# Creating tag ${tag_name}
# Create tag ${tag_name}
git tag -a ${tag_name} -m "chore(release): release ${tag_name}"

# Updating changelog
# Update changelog
changelog=$(git-chglog ${tag_name})
printf '%s\n\n%s\n' "${changelog}}" "$(cat CHANGELOG.md)" > CHANGELOG.md

# Commiting changes
# Commit changes
git add CHANGELOG.md garden-service/package.json garden-service/package-lock.json && git commit -m "chore(release): bump version to ${version}"

# Pushing tag
# Update tag
git tag -f -a ${tag_name} -m "chore(release): release ${tag_name}"

# Push tag
git push origin ${tag_name} --no-verify

echo "
***
-------------------------------------------------------------------------------
Version ${version} has been tagged, committed, and pushed to Github! 🎉
A CI job that creates the release artifcats is currently in process.
A CI job that creates the release artifcats is currently in process: https://circleci.com/gh/garden-io/garden
Please refer to our contributing docs for the next steps: https://github.com/garden-io/garden/blob/master/CONTRIBUTING.md
***
-------------------------------------------------------------------------------
"
}

Expand Down

0 comments on commit 27a3b9f

Please sign in to comment.