Publish using github actions

dev/0.11
modmuss50 2020-11-15 17:32:57 +00:00
parent d1281be741
commit 98725f9400
4 changed files with 38 additions and 26 deletions

29
.github/workflows/publish.yml vendored Normal file
View File

@ -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 }}

View File

@ -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

15
Jenkinsfile vendored
View File

@ -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"
}

View File

@ -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
}
}
}