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
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release App
on:
push:
branches:
- release
- 'release/v**'

jobs:
release-macos:
Expand All @@ -27,6 +27,9 @@ jobs:
run: yarn install

- name: Build
env:
OAUTH_CLIENT_ID: ${{ secrets.oauth_client_id }}
OAUTH_CLIENT_SECRET: ${{ secrets.oauth_client_secret }}
run: yarn build

- name: Pack (electron-builder)
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,41 @@ Gitify currently only supports mac OS.

### Development

First you will need to set the testing `CLIENT_ID` and `CLIENT_SECRET` in `src/js/utils/constants.js` file. You can use the development app credentials (use at your own discretion):
Optional: If you want you use your own OAuth credentials, you can do so by passing them as environment variables when bundling the app. This is optional as the app has some default "development" keys (use at your own discretion).

Client Id: 3fef4433a29c6ad8f22c
Client Secret Key: 9670de733096c15322183ff17ed0fc8704050379
OAUTH_CLIENT_ID="123" OAUTH_CLIENT_SECRET="456789" yarn build

To watch for changes in the `src` directory:
To watch for changes(`webpack`) in the `src` directory:

yarn run watch

To run the actual **electron app**:

yarn start

### Distribution
### Releases

To prepare the app for distribution run:
The release process is automated. Follow the steps below.

yarn run build
yarn run pack
yarn run make:macos
1. Create a [new **draft** release](https://github.com/manosim/gitify/releases/new). Set the tag version to something with the format of `v1.2.3`. Save as a **draft**.
2. Once everything is merged to `master`, create a branch that starts with `release/vX.X.X` (ie. `release/v1.2.3`).
3. In the same branch, **bump the version** of the app in the `package.json` file and open a PR. GitHub Actions will build, sign and upload the release assets for each commit to that branch as long as a branch is named like `release/vX.X.X` and there is a draft release with the same version number(`package.json`).
4. Merge your release branch into `master`.
5. Publish the draft release once you've added notes to it and all assets are there.

### Tests

There are 2 linters for `js` & `scss` and unit tests with `jest`.
There are 2 checks - one for prettier and one for the unit tests with `jest`.

// Run only unit tests
yarn run jest
// Run prettier to check
yarn run prettier-check

// Run linter & unit tests with coverage
yarn run test

// Run jest directly - allows to pass arguments like `--watch`
yarn run jest

### FAQ

#### My notifications aren't showing?
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gitify",
"version": "3.0.0",
"version": "3.0.1",
"description": "GitHub Notifications on your menu bar.",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -50,6 +50,9 @@
"homepage": "https://www.gitify.io/",
"jest": {
"preset": "ts-jest/presets/js-with-ts",
"setupFiles": [
"<rootDir>/src/js/__helpers__/setupEnvVars.js"
],
"testEnvironment": "jsdom",
"coverageThreshold": {
"global": {
Expand Down
2 changes: 2 additions & 0 deletions src/js/__helpers__/setupEnvVars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
process.env.OAUTH_CLIENT_ID = 'FAKE_CLIENT_ID_123';
process.env.OAUTH_CLIENT_SECRET = 'FAKE_CLIENT_SECRET_123';
4 changes: 2 additions & 2 deletions src/js/utils/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default {

DEFAULT_AUTH_OPTIONS: {
hostname: 'github.com',
clientId: '3fef4433a29c6ad8f22c',
clientSecret: '9670de733096c15322183ff17ed0fc8704050379',
clientId: process.env.OAUTH_CLIENT_ID,
clientSecret: process.env.OAUTH_CLIENT_SECRET,
},

REPO_SLUG: 'manosim/gitify',
Expand Down
4 changes: 2 additions & 2 deletions src/js/utils/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('utils/helpers.ts', () => {

expect(new BrowserWindow().loadURL).toHaveBeenCalledTimes(1);
expect(new BrowserWindow().loadURL).toHaveBeenCalledWith(
'https://github.com/login/oauth/authorize?client_id=3fef4433a29c6ad8f22c&scope=user:email,notifications'
'https://github.com/login/oauth/authorize?client_id=FAKE_CLIENT_ID_123&scope=user:email,notifications'
);

expect(new BrowserWindow().destroy).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -171,7 +171,7 @@ describe('utils/helpers.ts', () => {

expect(new BrowserWindow().loadURL).toHaveBeenCalledTimes(1);
expect(new BrowserWindow().loadURL).toHaveBeenCalledWith(
'https://github.com/login/oauth/authorize?client_id=3fef4433a29c6ad8f22c&scope=user:email,notifications'
'https://github.com/login/oauth/authorize?client_id=FAKE_CLIENT_ID_123&scope=user:email,notifications'
);

expect(new BrowserWindow().destroy).toHaveBeenCalledTimes(1);
Expand Down
8 changes: 8 additions & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');
const webpack = require('webpack');

module.exports = {
mode: 'development',
Expand All @@ -14,6 +15,13 @@ module.exports = {
},
],
},
plugins: [
new webpack.EnvironmentPlugin({
// Development Keys - See README.md
OAUTH_CLIENT_ID: '3fef4433a29c6ad8f22c',
OAUTH_CLIENT_SECRET: '9670de733096c15322183ff17ed0fc8704050379',
}),
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
Expand Down