-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
856 additions
and
194 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,46 @@ | ||
name: svn2git CI | ||
on: [push, pull_request] | ||
jobs: | ||
pipeline: | ||
name: pipeline | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')" | ||
timeout-minutes: 40 | ||
env: | ||
NODE_VERSION: 12.16.1 | ||
SPRING_OUTPUT_ANSI_ENABLED: DETECT | ||
SPRING_JPA_SHOW_SQL: false | ||
JHI_DISABLE_WEBPACK_LOGS: true | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.16.1 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: '11.x' | ||
- name: 🪦 Install node.js packages | ||
run: npm install | ||
- name: Update platform | ||
run: sudo apt-get update | ||
- name: Install git-svn | ||
run: sudo apt-get install git-svn | ||
- name: 🔍 Analyze code with SonarQube | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
JASYPT_PWD: ${{ secrets.JASYPT_PWD }} | ||
run: | | ||
if [ -n $SONAR_TOKEN ]; then | ||
./mvnw -ntp verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -P-webpack -Djasypt.encryptor.password=$JASYPT_PWD | ||
else | ||
echo No SONAR_TOKEN, skipping... | ||
fi | ||
- name: 📦 Package application | ||
run: ./mvnw -ntp package -Pprod -DskipTests | ||
- name: 🐳 Build and publish docker image | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
run: | | ||
GIT_TAG=:${GITHUB_REF#refs/tags/} | ||
DOCKER_TAG=${GIT_TAG#:refs/heads/main} | ||
./mvnw -ntp jib:build -Djib.to.image=yodamad/svn2git:latest -Djib.to.auth.username="${{ secrets.DOCKERHUB_LOGIN }}" -Djib.to.auth.password="${{ secrets.DOCKERHUB_PWD }}" |
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 +1 @@ | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
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
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
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/fr/yodamad/svn2git/functions/HttpFunctions.kt
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,26 @@ | ||
package fr.yodamad.svn2git.functions | ||
|
||
import khttp.structures.authorization.BasicAuthorization | ||
import khttp.structures.files.FileLike | ||
|
||
fun uploadFileToGitlab(gitlabUrl: String, gitlabToken: String, projectId: Int, projectName: String, version: String, fileName: String, filePath: String) = | ||
khttp.put( | ||
url = "$gitlabUrl/api/v4/projects/$projectId/packages/generic/$projectName/$version/$fileName", | ||
headers = mapOf( | ||
Pair("PRIVATE-TOKEN", gitlabToken) | ||
), | ||
files = listOf( | ||
FileLike(fileName, filePath) | ||
) | ||
).statusCode | ||
|
||
fun uploadFileToNexus(nexusUrl: String, nexusRepo: String, nexusUser: String, nexusPwd: String, | ||
groupName: String, projectName: String, version: String, | ||
fileName: String, filePath: String) = | ||
khttp.put( | ||
url = "$nexusUrl/repository/$nexusRepo/$groupName/$projectName/$version/$fileName", | ||
auth = BasicAuthorization(nexusUser, nexusPwd), | ||
files = listOf( | ||
FileLike(fileName, filePath) | ||
) | ||
).statusCode |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/fr/yodamad/svn2git/functions/RegexFunctions.kt
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,17 @@ | ||
package fr.yodamad.svn2git.functions | ||
|
||
val FULL_VERSION = "\\d+\\.\\d+\\.\\d+".toRegex() | ||
val LITE_VERSION = "\\d+\\.\\d+".toRegex() | ||
|
||
fun extractVersion(fullName: String): String { | ||
var version = FULL_VERSION.find(fullName)?.groupValues?.firstOrNull() | ||
if (version == null) { | ||
version = LITE_VERSION.find(fullName)?.groupValues?.firstOrNull() | ||
if (version == null) { | ||
version = "0.0.0" | ||
} else { | ||
version += ".0" | ||
} | ||
} | ||
return version | ||
} |
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
Oops, something went wrong.