From 98725f9400e1b63f981bff0b3414a6003f34a7e1 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 15 Nov 2020 17:32:57 +0000 Subject: [PATCH] Publish using github actions --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/test-push.yml | 10 ++++------ Jenkinsfile | 15 --------------- build.gradle | 10 +++++----- 4 files changed, 38 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 Jenkinsfile diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f1f17c2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish +on: + push: + branches: + - 'dev/**' + +jobs: + build: + runs-on: ubuntu-20.04 + container: + image: openjdk:8-jdk + options: --user root + steps: + - uses: actions/checkout@v1 + - uses: gradle/wrapper-validation-action@v1 + + # Generate the build number based on tags to allow per branch build numbers, not something github provides by default. + - name: Generate build number + id: buildnumber + uses: einaregilsson/build-number@v3 + with: + token: ${{ secrets.github_token }} + prefix: ${{ github.ref }} + + - run: ./gradlew build publish -x test --stacktrace + env: + MAVEN_URL: ${{ secrets.MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/test-push.yml b/.github/workflows/test-push.yml index e0d4f3b..9bde1bf 100644 --- a/.github/workflows/test-push.yml +++ b/.github/workflows/test-push.yml @@ -4,15 +4,13 @@ jobs: gradle: strategy: matrix: - gradle: [4.9, 4.10.2, 6.6] - java: [jdk8, jdk11, jdk14] + gradle: [4.9, 4.10.2, 6.7] + java: [jdk8, jdk11, jdk15] exclude: # Dont run older gradle versions on newer java - - java: jdk14 + - java: jdk15 gradle: 4.9 - - java: jdk14 + - java: jdk15 gradle: 4.10.2 - - java: jdk14 - gradle: 5.6.4 - java: jdk11 gradle: 4.9 - java: jdk11 diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 094a0a7..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,15 +0,0 @@ -node { - stage 'Checkout' - - checkout scm - - stage 'Build' - - sh "rm -rf build/libs/" - sh "chmod +x gradlew" - sh "./gradlew build -x test --refresh-dependencies" - - stage "Archive artifacts" - - sh "./gradlew publish" -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 82384ce..95befe1 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ def baseVersion = '0.5' def build = 'local' def ENV = System.getenv() if (ENV.BUILD_NUMBER) { - build = "jenkins #${ENV.BUILD_NUMBER}" + build = "release #${ENV.BUILD_NUMBER}" version = baseVersion + '.' + ENV.BUILD_NUMBER } else { version = baseVersion + '.local' @@ -167,11 +167,11 @@ publishing { } repositories { maven { - url 'http://mavenupload.modmuss50.me/' - if (project.hasProperty('mavenPass')) { + if (ENV.MAVEN_URL) { + url ENV.MAVEN_URL credentials { - username 'buildslave' - password project.getProperty('mavenPass') + username ENV.MAVEN_USERNAME + password ENV.MAVEN_PASSWORD } } }