Skip to content

Commit

Permalink
Merge pull request #77 from defmethodinc/semantic-release
Browse files Browse the repository at this point in the history
Automate release process using semantic-release
  • Loading branch information
sbrudz authored May 11, 2020
2 parents 1cff744 + fbe4e21 commit 7a82b8f
Show file tree
Hide file tree
Showing 8 changed files with 10,068 additions and 2,568 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

name: Node.js CI

on: [push]
on:
push:
paths-ignore:
- 'package.json'
- 'manifest.json'

jobs:
build:
Expand All @@ -29,4 +33,23 @@ jobs:
- name: Run tests
run: npm test
env:
CI: true
CI: true

release:
needs: build
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta'

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17.0.4
extra_plugins: |
@semantic-release/git
@semantic-release/exec
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ just-not-sorry*.zip
.idea
node_modules
.DS_Store
dist
*.json.old
39 changes: 39 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"branches": [
"master",
{ "name": "beta", "prerelease": "beta" }
],
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/release-notes-generator",
{
"linkCompare": false
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "./package.sh ${nextRelease.version}"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "dist/just-not-sorry-chrome.zip",
"name": "just-not-sorry-${nextRelease.gitTag}.zip",
"label": "Chrome Web Store package"
}
]
}
],
[
"@semantic-release/git",
{
"assets": ["package.json", "manifest.json"]
}
]
]
}
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![](https://github.com/defmethodinc/just-not-sorry/workflows/Node.js%20CI/badge.svg) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

# Just Not Sorry -- the Gmail Plug-in
Inspired by the writings of Tara Mohr and others, this Chrome Extension for Gmail will warn you when you use phrases that might be undermining your message.

Expand All @@ -21,26 +23,28 @@ If you're a developer, you're welcome to submit a pull request. Please run the
**NOTE:** All warning phrases must include a link to an article that explains why the phrase could negatively impact someone's message. If available, please also include alternative wording suggestions from the article.

### Development Setup
* `git clone` the repo
* Follow the [instructions on the Chrome docs](https://developer.chrome.com/extensions/getstarted#unpacked) to load the extension
* Go to Gmail and open a compose window
* If you make changes to the code, click the Reload link on the `chrome://extensions` page and then reload your Gmail tab to pick up the changes.
* Errors will show up in the console

Prerequisites:
* [git](https://git-scm.com/)
* [node.js 12.X+](https://nodejs.org/)

Setup:
* `git clone` the repo
* Run `npm install` in the project root
* Follow the [instructions on the Chrome docs](https://developer.chrome.com/extensions/getstarted#unpacked) to load the extension
* Go to Gmail and open a compose window
* If you make changes to the code, click the Reload link on the `chrome://extensions` page and then reload your Gmail tab to pick up the changes.
* Errors will show up in the console

### Coding Standards
Use [JSCS](http://jscs.info/) with the AirBnB preset.

### Commit Message Conventions
Commit messages are required to follow the [AngularJS's commit message convention](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). This allows us to automatically increment the version numbering of the extension using the [SemVer](https://semver.org/) standard and generate release notes. We use the [Commitizen](https://github.com/commitizen/cz-cli) library to provide interactive prompts to help generate the commit messages. Once you've run `npm install` as instructed in the development setup section, Commitizen will be run whenever you execute the `git commit` command.

### Jasmine Tests
Tests are written using [jasmine](https://jasmine.github.io/). They can either be run from the command line using headless chrome or run within a browser window.

First, make sure that node.js and npm are installed. Then in the project root, run:

```
npm install
```

This will install the required packages to run the tests, including a headless version of Chrome that will be controlled via Puppeteer.

To run the headless tests, use:

```
Expand All @@ -56,12 +60,9 @@ npm run test:watch
and then open http://localhost:8888 in a web browser.

### To Publish a New Version to Chrome Webstore
1. Make sure all the tests pass
1. Update the version number in `manifest.json` and commit the change to master.
Use [semantic versioning](http://semver.org/) to determine how to increment the version number
1. Run the `package.sh` shell script to generate a zip file
1. Go to [Chrome Developer Dashboard](https://chrome.google.com/webstore/developer/dashboard) and edit the existing app. Upload the new zip file and then publish the changes (button is at the very bottom)
1. Tag the new release in [GitHub](https://github.com/defmethodinc/just-not-sorry/releases) and include release notes
This project uses the [semantic-release](https://semantic-release.gitbook.io/semantic-release/) library and [GitHub Actions](https://help.github.com/en/actions) to automate the release process. Once a pull request has been merged into the master branch, a new [GitHub release](https://github.com/defmethodinc/just-not-sorry/releases) will be created. A zip file containing the updated files for the Chrome web store will be attached.

To publish this release, download the zip file from GitHub. Find the Just Not Sorry extension on the [Chrome Developer Dashboard](https://chrome.google.com/webstore/devconsole/) (credentials available to DefMethod developers upon request), upload the zip file, and click the "Publish Item" button.

### Libraries Used
For production:
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Just Not Sorry -- the Gmail Plug-in",
"short_name": "JustNotSorry",
"author": "Steve Brudz, Manish Kakwani, Tami Reiss, and Eric Tillberg of Def Method",
"version": "1.6.3",
"version": "1.7.0",
"description": "A Gmail Plug-in that warns you when you write emails using words which undermine your message",
"icons": { "16": "img/JustNotSorry-16.png",
"48": "img/JustNotSorry-48.png",
Expand Down
Loading

0 comments on commit 7a82b8f

Please sign in to comment.