This repository has been archived by the owner on Dec 21, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add semantic-release and docker
- Loading branch information
Showing
8 changed files
with
93 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
dist: trusty | ||
language: node_js | ||
services: docker | ||
|
||
node_js: | ||
- "10" | ||
- "12" | ||
|
||
before_install: | ||
- npm install -g greenkeeper-lockfile@1 | ||
- npm i @semantic-release/exec | ||
|
||
before_script: greenkeeper-lockfile-update | ||
|
||
script: | ||
- npm run build -s | ||
- npm run test -s | ||
- npm run lint -s | ||
- docker build . -t fossapps/merge-when-ready | ||
- npx semantic-release | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
|
||
deploy: | ||
provider: script | ||
script: "./scripts/deploy.sh" | ||
skip_cleanup: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM node:12-alpine | ||
MAINTAINER fossapps gautam.nishchal@gmail.com | ||
WORKDIR /app | ||
ADD node_modules ./node_modules | ||
ADD ./lib ./lib | ||
EXPOSE 3000 | ||
ADD package.json ./package.json | ||
CMD ["node", "./lib/server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
class SemanticReleaseError extends Error { | ||
constructor(message, code, details) { | ||
super(message); | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = 'SemanticReleaseError'; | ||
this.details = details; | ||
this.code = code; | ||
this.semanticRelease = true; | ||
} | ||
} | ||
|
||
module.exports = { | ||
verifyConditions: [ | ||
() => { | ||
if (!process.env.DOCKERHUB_LOGIN) { | ||
throw new SemanticReleaseError( | ||
"No DOCKERHUB_LOGIN specified", | ||
"ENODOCKERHUB_LOGIN", | ||
"Please make sure to add docker hub user in `DOCKERHUB_LOGIN` environment variable on your CI environment. The token must be able to push docker image"); | ||
} | ||
if (!process.env.GH_TOKEN) { | ||
throw new SemanticReleaseError( | ||
"No GH_TOKEN specified", | ||
"ENOGH_TOKEN", | ||
"Please make sure to github token in `GH_TOKEN` environment variable on your CI environment. The token must be able to create releases"); | ||
} | ||
if (!process.env.DOCKERHUB_PASSWORD) { | ||
throw new SemanticReleaseError( | ||
"No DOCKERHUB_PASSWORD specified", | ||
"ENODOCKERHUB_PASSWORD", | ||
"Please make sure to add docker password in `DOCKERHUB_PASSWORD` environment variable on your CI environment."); | ||
} | ||
}, | ||
"@semantic-release/github" | ||
], | ||
prepare: [ | ||
{ | ||
path: "@semantic-release/exec", | ||
cmd: "docker tag fossapps/merge-when-ready:latest fossapps/merge-when-ready:${nextRelease.version}" | ||
}, | ||
{ | ||
path: "@semantic-release/exec", | ||
cmd: "echo \"$DOCKERHUB_PASSWORD\" | docker login -u \"$DOCKERHUB_LOGIN\" --password-stdin" | ||
} | ||
], | ||
publish: [ | ||
{ | ||
path: "@semantic-release/exec", | ||
cmd: "docker push fossapps/merge-when-ready" | ||
}, | ||
{ | ||
path: "@semantic-release/exec", | ||
cmd: "docker push fossapps/merge-when-ready:${nextRelease.version}" | ||
}, | ||
{ | ||
path: "@semantic-release/exec", | ||
cmd: "./scripts/deploy.sh" | ||
}, | ||
"@semantic-release/github" | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {Probot} from "probot"; | ||
import {App} from "./App"; | ||
import {getAppConfig} from "./AppConfig"; | ||
|
||
const appConfig = getAppConfig(); | ||
const probot = new Probot(appConfig); | ||
probot.load(App.handle); | ||
|
||
probot.start(); |