Skip to content

Commit 141a05b

Browse files
jeffmauryadietish
authored andcommitted
chore: Add Jenkinsfile
Also add missing files Signed-off-by: Jeff MAURY <[email protected]>
1 parent 07c61eb commit 141a05b

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "Conventional Commits PR Check"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/[email protected]
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Generate changelog and plugin archive for new release
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up JDK 1.8
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 1.8
15+
- name: Grant execute permission for gradlew
16+
run: chmod +x gradlew
17+
- name: Build with Gradle
18+
run: ./gradlew buildPlugin
19+
- name: Get the version
20+
id: get_version
21+
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
22+
- name: Simple conventional changelog
23+
uses: lstocchi/[email protected]
24+
id: changelog
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
current-tag: ${{ steps.get_version.outputs.VERSION }}
28+
types-mapping: 'feat:Features,fix:Bug Fixes,docs:Documentation,refactor:Refactoring,chore:Other'
29+
- run: |
30+
echo '${{ steps.changelog.outputs.changelog }}'
31+
- name: Create Release
32+
id: create_release
33+
uses: actions/create-release@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
tag_name: ${{ steps.get_version.outputs.VERSION }}
38+
release_name: ${{ steps.get_version.outputs.VERSION }}
39+
body: ${{ steps.changelog.outputs.changelog }}
40+
- name: Attach zip to release
41+
uses: actions/upload-release-asset@v1
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
upload_url: ${{ steps.create_release.outputs.upload_url }}
46+
asset_path: '${{ github.workspace }}/build/distributions/Telemetry by Red Hat-${{ steps.get_version.outputs.VERSION }}.zip'
47+
asset_name: 'Telemetry by Red Hat-${{ steps.get_version.outputs.VERSION }}.zip'
48+
asset_content_type: application/zip

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
target
2+
.idea
3+
*.iml
4+
build
5+
.gradle
6+
out

Jenkinsfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env groovy
2+
3+
node('rhel7'){
4+
stage('Checkout repo') {
5+
deleteDir()
6+
git url: 'https://github.com/redhat-developer/intellij-redhat-telemetry',
7+
branch: "${sha1}"
8+
}
9+
10+
def props = readProperties file: 'gradle.properties'
11+
def isSnapshot = props['projectVersion'].contains('-SNAPSHOT')
12+
def version = isSnapshot?props['projectVersion'].replace('-SNAPSHOT', ".${env.BUILD_NUMBER}"):props['projectVersion'] + ".${env.BUILD_NUMBER}"
13+
14+
stage('Build') {
15+
sh "./gradlew assemble -PprojectVersion=${version}"
16+
}
17+
18+
stage('Package') {
19+
sh "./gradlew buildPlugin -PprojectVersion=${version}"
20+
}
21+
22+
if(params.UPLOAD_LOCATION) {
23+
stage('Upload') {
24+
def filesToPush = findFiles(glob: '**/*.zip')
25+
sh "rsync -Pzrlt --rsh=ssh --protocol=28 ${filesToPush[0].path} ${UPLOAD_LOCATION}/snapshots/intellij-redhat-telemetry/"
26+
stash name:'zip', includes:filesToPush[0].path
27+
}
28+
}
29+
30+
if(publishToMarketPlace.equals('true')){
31+
timeout(time:5, unit:'DAYS') {
32+
input message:'Approve deployment?', submitter: 'jmaury'
33+
}
34+
35+
def channel = isSnapshot?"nightly":"stable"
36+
37+
stage("Publish to Marketplace") {
38+
unstash 'zip'
39+
withCredentials([[$class: 'StringBinding', credentialsId: 'JetBrains marketplace token', variable: 'TOKEN']]) {
40+
sh "./gradlew publishPlugin -PjetBrainsToken=${TOKEN} -PprojectVersion=${version} -PjetBrainsChannel=${channel}"
41+
}
42+
archive includes:"**.zip"
43+
44+
if (!isSnapshot) {
45+
stage("Promote the build to stable") {
46+
def zip = findFiles(glob: '**/*.zip')
47+
sh "rsync -Pzrlt --rsh=ssh --protocol=28 ${zip[0].path} ${UPLOAD_LOCATION}/stable/intellij-redhat-telemetry/"
48+
}
49+
}
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)