Skip to content

Commit

Permalink
Update release workflow
Browse files Browse the repository at this point in the history
Configure Sentry sourcemaps
  • Loading branch information
proAlexandr committed Jul 30, 2019
1 parent 126b5b0 commit e5d52a6
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 75 deletions.
49 changes: 0 additions & 49 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,52 +33,3 @@ steps:
when:
status:
- failure

---

kind: pipeline
name: release
trigger:
event: push
branch: release
steps:
- name: build-dist
image: node:10.16
environment:
GH_TOKEN:
from_secret: gh_token
SENTRY_DSN:
from_secret: sentry_dsn
GA_TRACKING_ID:
from_secret: ga_tracking_id
commands:
- npm install
- npm run build:dist

- name: build-target-win
image: proalexandr/node-wine
environment:
GH_TOKEN:
from_secret: gh_token
SENTRY_DSN:
from_secret: sentry_dsn
GA_TRACKING_ID:
from_secret: ga_tracking_id
commands:
- npm run build:target -- --win -p always
depends_on:
- build-dist

- name: build-target-linux
image: node:10.16
environment:
GH_TOKEN:
from_secret: gh_token
SENTRY_DSN:
from_secret: sentry_dsn
GA_TRACKING_ID:
from_secret: ga_tracking_id
commands:
- npm run build:target -- --linux -p always
depends_on:
- build-dist
11 changes: 11 additions & 0 deletions .electron-vue/plugins/sentry-webpack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const packageJson = require('../../package.json')

const SentryWebpackPlugin = require('@sentry/webpack-plugin')

module.exports = new SentryWebpackPlugin({
release: `${packageJson.name}@${packageJson.version}`,
silent: true,
include: ['.'],
ignore: ['node_modules', '.electron-vue', 'build', 'cypress', 'test', 'src'],
configFile: 'sentry.properties'
})
14 changes: 8 additions & 6 deletions .electron-vue/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
process.env.BABEL_ENV = 'main'

const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')
const packageJson = require('../package.json')
const sentryWebpackPlugin = require('./plugins/sentry-webpack')

let mainConfig = {
entry: {
main: path.join(__dirname, '../src/main/index.js')
},
externals: [
...Object.keys(dependencies || {})
...Object.keys(packageJson.dependencies || {})
],
module: {
rules: [
Expand Down Expand Up @@ -63,12 +63,14 @@ if (process.env.NODE_ENV !== 'production') {
if (process.env.NODE_ENV === 'production') {
mainConfig.devtool = 'source-map'

mainConfig.plugins.push(
mainConfig.plugins = [
...mainConfig.plugins,
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"',
'process.env.SENTRY_DSN': `"${process.env.SENTRY_DSN}"`
})
)
}),
process.env.RELEASE === 'true' ? sentryWebpackPlugin : null
].filter(Boolean)
}

module.exports = mainConfig
13 changes: 8 additions & 5 deletions .electron-vue/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
process.env.BABEL_ENV = 'renderer'

const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')

const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')

const { dependencies } = require('../package.json')
const sentryWebpackPlugin = require('./plugins/sentry-webpack')

/**
* List of node_modules to include in webpack bundle
*
Expand Down Expand Up @@ -157,7 +158,8 @@ if (process.env.NODE_ENV !== 'production') {
if (process.env.NODE_ENV === 'production') {
rendererConfig.devtool = 'source-map'

rendererConfig.plugins.push(
rendererConfig.plugins = [
...rendererConfig.plugins,
new CopyWebpackPlugin([
{
from: path.join(__dirname, '../static'),
Expand All @@ -172,8 +174,9 @@ if (process.env.NODE_ENV === 'production') {
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
)
}),
process.env.RELEASE === 'true' ? sentryWebpackPlugin : null
].filter(Boolean)
}

module.exports = rendererConfig
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ which will be used to connect to a resource. Let's see an example of a problem t
1) If the user tries to forward the resource in Kube Forwarder again, most likely there will be an error
since a connection will be established with `remote-cluster`, not `local-cluster` as the user expected,
and `remote-cluster` couldn't have `postgres` resource.
So, to avoid the error we should store the current context in a separate field.

So, to avoid the error we should store the current context in a separate field.

<a target="_blank" href="https://user-images.githubusercontent.com/2697570/60754775-58a4ca80-9fe6-11e9-8d67-d15a1423b506.png"><img width="320" alt="Screenshot 2019-07-06 at 12 04 45" src="https://user-images.githubusercontent.com/2697570/60754775-58a4ca80-9fe6-11e9-8d67-d15a1423b506.png"></a>

Expand Down Expand Up @@ -218,22 +219,23 @@ npm run test:cypress:open

## Release guide

1) Be sure that you created `.env.production` and filled it in the right way.
2) Update the version in `package.json`.
3) Push to `release` branch. [Drone(pixel-point/kube-forwarder)](https://drone.pixelpoint.io/pixel-point/kube-forwarder/)
will build packages for Windows and Linux and upload them to [releases](https://github.com/pixel-point/kube-forwarder/releases)
4) Run `npm run release` on a Mac computer to build `.dmg` target.
It will be automatically pushed to releases at Github.
5) Go to [Releases](https://github.com/pixel-point/kube-forwarder/releases) in the repository.
### Configure environment

Also, this steps could be used to configure CI environment.

1) Copy `.env.example` to `.env.production` and fill variables.

### Release steps

1) Update the version in `package.json` and Push to `release` branch.
1) Run `npm run release` on a Mac computer to build packages. They will be automatically pushed to releases at Github.
1) Go to [Releases](https://github.com/pixel-point/kube-forwarder/releases) in the repository.
Make sure that the created draft is OK and release it (Edit -> Release).
6) Run `cask-repair kube-forwarder` to update the cask version.
1) Run `cask-repair kube-forwarder` to update the cask version.
([https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask](About cask-repair))

Notes:
1) `.dmg` target is added to release by your mac computer.
`.AppImage` and `.exe` have to be added to the release by drone CI.
2) A release tag (for example: `v1.0.3`) will be added automatically
by Github when you release your draft.
1) A release tag (for example: `v1.0.3`) will be added to GIT automatically by Github when you release your draft.

## Development tips

Expand Down
49 changes: 49 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
"upload": "./upload.sh",
"release": "npm run build -- -- -p always",
"release": "RELEASE=true npm run build -- -- -p always --mac --linux --win",
"dev": "BUILD=DEV-VERSION node .electron-vue/dev-runner.js",
"web": "BUILD=WEB-VERSION node .electron-vue/web-runner.js",
"e2e": "npm run pack && mocha test/e2e",
Expand Down Expand Up @@ -109,6 +109,7 @@
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/runtime-corejs2": "^7.5.5",
"@sentry/webpack-plugin": "^1.7.0",
"ajv": "^6.7.0",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/common/configure-sentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function configureSentry(configOverrides = {}) {
if (!process.env.SENTRY_DSN) return

Sentry.init({
release: `${packageJson.name}@${packageJson.version}`,
dsn: process.env.SENTRY_DSN,
defaultIntegrations: false,
async beforeSend(event) {
Expand Down
1 change: 0 additions & 1 deletion src/renderer/components/Layout/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<script>
import packageJs from '../../../../package'
import { showMessageBox } from '../../lib/helpers/ui'
import * as Sentry from '@sentry/electron'
export default {
name: 'Toolbar',
Expand Down

0 comments on commit e5d52a6

Please sign in to comment.