forked from jfrog/jfrog-azure-devops-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
91 lines (78 loc) · 3.19 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
node("docker") {
cleanWs()
stage('Clone') {
sh 'git clone https://github.com/jfrog/artifactory-azure-devops-extension.git'
}
stage('Install Prerequisites') {
sh '''#!/bin/bash
apt update
apt install wget -y
apt install file
'''
}
stage('Downloading npm') {
sh '''#!/bin/bash
set -euxo pipefail
echo "Downloading npm..."
wget https://nodejs.org/dist/v${NPM_VERSION}/node-v${NPM_VERSION}-linux-x64.tar.xz
tar -xvf node-v${NPM_VERSION}-linux-x64.tar.xz
'''
}
withEnv(["PATH+=${WORKSPACE}/node-v${NPM_VERSION}-linux-x64/bin"]) {
dir('artifactory-azure-devops-extension') {
stage('Merge to master') {
sh("git merge origin/dev")
}
stage('Bump version') {
sh '''#!/bin/bash
set -euxo pipefail
npm i --prefix=buildScripts
node buildScripts/bump-version.js -v ${ADO_ARTIFACTORY_VERSION}
'''
}
stage('Create extension') {
sh '''#!/bin/bash
set -euxo pipefail
npm i --unsafe-perm
npm run create
# Verify vsix file is larger than 15M
find . -iname "JFrog.jfrog-artifactory-vsts-extension*" -size +15M | grep .
'''
}
stage('Git config') {
sh '''#!/bin/bash
git config user.name "jfrog-ecosystem"
git config user.email "eco-system@jfrog.com"
'''
}
stage('Commit release version') {
sh("git commit -am '[artifactory-release] Release version ${ADO_ARTIFACTORY_VERSION}'")
}
wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: 'GITHUB_API_KEY', var: 'SECRET']]]) {
stage('Push changes') {
sh("git push https://${GITHUB_USERNAME}:${GITHUB_API_KEY}@github.com/jfrog/artifactory-azure-devops-extension.git")
}
stage('Create tag') {
sh("git tag '${ADO_ARTIFACTORY_VERSION}'")
sh("git push https://${GITHUB_USERNAME}:${GITHUB_API_KEY}@github.com/jfrog/artifactory-azure-devops-extension.git --tags")
}
stage('Merge to dev') {
sh '''#!/bin/bash
set -euxo pipefail
git checkout dev
git merge master
git push https://${GITHUB_USERNAME}:${GITHUB_API_KEY}@github.com/jfrog/artifactory-azure-devops-extension.git
'''
}
}
stage('Publish extension') {
withCredentials([string(credentialsId: 'azure-devops-publisher', variable: 'ADO_PUBLISHER_API_KEY')]) {
sh '''#!/bin/bash
set -euxo pipefail
./node_modules/tfx-cli/_build/tfx-cli.js extension publish -t ${ADO_PUBLISHER_API_KEY}
'''
}
}
}
}
}