Skip to content

Commit

Permalink
chore: Add Jenkinsfile
Browse files Browse the repository at this point in the history
Also add missing files

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
  • Loading branch information
jeffmaury authored and adietish committed Mar 15, 2021
1 parent 07c61eb commit 141a05b
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/conventionalCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Conventional Commits PR Check"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v3.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Generate changelog and plugin archive for new release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew buildPlugin
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Simple conventional changelog
uses: lstocchi/simple-conventional-changelog@0.0.6
id: changelog
with:
token: ${{ secrets.GITHUB_TOKEN }}
current-tag: ${{ steps.get_version.outputs.VERSION }}
types-mapping: 'feat:Features,fix:Bug Fixes,docs:Documentation,refactor:Refactoring,chore:Other'
- run: |
echo '${{ steps.changelog.outputs.changelog }}'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
body: ${{ steps.changelog.outputs.changelog }}
- name: Attach zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: '${{ github.workspace }}/build/distributions/Telemetry by Red Hat-${{ steps.get_version.outputs.VERSION }}.zip'
asset_name: 'Telemetry by Red Hat-${{ steps.get_version.outputs.VERSION }}.zip'
asset_content_type: application/zip
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target
.idea
*.iml
build
.gradle
out
52 changes: 52 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env groovy

node('rhel7'){
stage('Checkout repo') {
deleteDir()
git url: 'https://github.com/redhat-developer/intellij-redhat-telemetry',
branch: "${sha1}"
}

def props = readProperties file: 'gradle.properties'
def isSnapshot = props['projectVersion'].contains('-SNAPSHOT')
def version = isSnapshot?props['projectVersion'].replace('-SNAPSHOT', ".${env.BUILD_NUMBER}"):props['projectVersion'] + ".${env.BUILD_NUMBER}"

stage('Build') {
sh "./gradlew assemble -PprojectVersion=${version}"
}

stage('Package') {
sh "./gradlew buildPlugin -PprojectVersion=${version}"
}

if(params.UPLOAD_LOCATION) {
stage('Upload') {
def filesToPush = findFiles(glob: '**/*.zip')
sh "rsync -Pzrlt --rsh=ssh --protocol=28 ${filesToPush[0].path} ${UPLOAD_LOCATION}/snapshots/intellij-redhat-telemetry/"
stash name:'zip', includes:filesToPush[0].path
}
}

if(publishToMarketPlace.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'jmaury'
}

def channel = isSnapshot?"nightly":"stable"

stage("Publish to Marketplace") {
unstash 'zip'
withCredentials([[$class: 'StringBinding', credentialsId: 'JetBrains marketplace token', variable: 'TOKEN']]) {
sh "./gradlew publishPlugin -PjetBrainsToken=${TOKEN} -PprojectVersion=${version} -PjetBrainsChannel=${channel}"
}
archive includes:"**.zip"

if (!isSnapshot) {
stage("Promote the build to stable") {
def zip = findFiles(glob: '**/*.zip')
sh "rsync -Pzrlt --rsh=ssh --protocol=28 ${zip[0].path} ${UPLOAD_LOCATION}/stable/intellij-redhat-telemetry/"
}
}
}
}
}

0 comments on commit 141a05b

Please sign in to comment.