-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add CI/CD Jenkins Groovy pipeline and semver releaserc
- Introduced `Jenkinsfile` for a simple CD pipeline - Added semver using `semantic-release` (`.releaserc`) Fixes issue #4
- Loading branch information
1 parent
0480210
commit 781475e
Showing
4 changed files
with
7,864 additions
and
1,457 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"branches": [ | ||
"master" | ||
], | ||
"repositoryUrl": "https://github.com/csye7125-fall2023-group05/webapp.git", | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
[ | ||
"@semantic-release/npm", | ||
{ | ||
"npmPublish": false | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"package.json", | ||
"package-lock.json", | ||
"CHANGELOG.md" | ||
] | ||
} | ||
], | ||
"@semantic-release/github" | ||
], | ||
"release": { | ||
"verifyConditions": { | ||
"path": [ | ||
"@semantic-release/changelog", | ||
"@semantic-release/github", | ||
"@semantic-release/git" | ||
] | ||
}, | ||
"analyzeCommits": [ | ||
"@semantic-release/commit-analyzer" | ||
], | ||
"generateNotes": [ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
"preset": "angular", | ||
"writerOpts": { | ||
"commitsSort": [ | ||
"header" | ||
] | ||
} | ||
} | ||
], | ||
"prepare": [ | ||
"@semantic-release/git", | ||
{ | ||
"path": "@semantic-release/changelog", | ||
"changelogFile": "CHANGELOG.md" | ||
} | ||
], | ||
"publish": "@semantic-release/github", | ||
"success": "@semantic-release/github", | ||
"fail": "@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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
pipeline { | ||
agent any | ||
tools { nodejs "node" } | ||
environment { | ||
GH_TOKEN = credentials('jenkins-pat') | ||
} | ||
stages { | ||
stage('Clone repository') { | ||
when { | ||
branch 'master' | ||
} | ||
steps { | ||
cleanWs() | ||
checkout scm | ||
} | ||
} | ||
stage('Release with semantic-release') { | ||
when { | ||
branch 'master' | ||
} | ||
steps { | ||
sh ''' | ||
npm ci | ||
npx semantic-release | ||
''' | ||
} | ||
} | ||
stage('Build Image') { | ||
when { | ||
branch 'master' | ||
} | ||
steps { | ||
sh 'docker build --no-cache -t quay.io/pwncorp/producer:$(npm pkg get version | xargs) -t quay.io/pwncorp/producer:latest -f Dockerfile .' | ||
} | ||
} | ||
stage('Push Image') { | ||
when { | ||
branch 'master' | ||
} | ||
steps { | ||
withCredentials([usernamePassword(credentialsId: 'dockerHub', passwordVariable: 'DOCKERHUB_PASSWORD', usernameVariable: 'DOCKERHUB_USERNAME')]) { | ||
sh 'docker login quay.io -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD' | ||
sh 'docker image push --all-tags quay.io/pwncorp/producer' | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
sh 'docker logout' | ||
sh 'docker system prune -a -f' | ||
} | ||
} | ||
} |
Oops, something went wrong.