Skip to content

Commit

Permalink
Merge pull request #30 from voxmedia/jl-ba-ac-semantic-release
Browse files Browse the repository at this point in the history
Switch to semantic release
  • Loading branch information
Josh Larson authored Nov 20, 2020
2 parents fbc1c18 + f9939d4 commit 4820377
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 38 deletions.
4 changes: 0 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## Purpose

## Important Changes

## Changelog

- [ ] I have updated `CHANGELOG.md` under "Unreleased" with the changes included in this PR.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ jobs:
yarn test
env:
CI: true
- name: yarn build
run: yarn build
- name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
- name: update v1 tag
run: 'git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify slack success
if: env.SLACK_BOT_TOKEN
env:
Expand Down
35 changes: 2 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,9 @@ To report bugs or to request new features, you may [create a new issue](https://

## Releasing a New Version

Please use [semantic versioning](https://semver.org) when releasing new versions of the action, per [GitHub's recommendations](https://help.github.com/en/github/automating-your-workflow-with-github-actions/about-actions#versioning-your-action).
Please use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) when contributing to the repository. If you've forgotten to use conventional commits, a maintainer can include the prefix in the merge commit when merging a PR.

After a new PR has been merged, you should promote unreleased changes in `CHANGELOG.md` to a new heading containing the new version and today's date.

Then, an engineer should run locally:

```bash
# pull down the latest changes
git checkout main && git pull

# build out the new dist code
yarn build

# commit it (where X.X.X is the new version)
git commit -am 'vX.X.X'

# tag the specific version (where X.X.X is the new version)
git tag -a vX.X.X -m 'vX.X.X'

# update the tag for the major version (where X is the major version)
# FIRST: delete the existing major version tag
git tag -d vX

# NEXT: re-add the major version tag
git tag vX

# FINALLY: remove the old major version tag from remote origin:
git push origin :refs/tags/vX

# push up the commit and the new tags
git push && git push --tags
```

Finally, issue a [new GitHub release](https://github.com/voxmedia/github-action-slack-notify-build/releases) for the corresponding version, detailing what has changed.
Releases happen automatically when merged into `main` with [semantic-release](https://semantic-release.gitbook.io/semantic-release/).

## Code of Conduct

Expand Down
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@zeit/ncc": "^0.20.5",
"babel-jest": "^24.9.0",
"husky": "^3.0.9",
Expand All @@ -26,5 +28,41 @@
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"release": {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json",
"dist"
]
}
]
],
"branches": [
"main",
"+([0-9])?(.{+([0-9]),x}).x",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
]
}
}
Loading

0 comments on commit 4820377

Please sign in to comment.