Skip to content

Commit

Permalink
Added a release script and publish gradle task.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannestegner committed Jun 17, 2020
1 parent 2a52019 commit 326f9bf
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release
on:
release:
types: [published]
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1

- name: Build with Gradle
run: gradle build

- name: Publish to GitHub Packages
run: gradle publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Test
on:
push:
pull_request:
Expand All @@ -8,7 +9,7 @@ jobs:
strategy:
matrix:
java: [ 8, 10, 12, 13 ]
name: Java ${{ matrix.java }} sample
name: Java ${{ matrix.java }} test.
steps:
- uses: actions/checkout@v2
- name: Setup java
Expand Down
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
plugins {
id("maven-publish")
}

apply plugin: 'java-library'
apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8

Expand Down Expand Up @@ -27,3 +32,21 @@ test {
exceptionFormat "full"
}
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/personnummer/java")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
from(components.java)
}
}
}

0 comments on commit 326f9bf

Please sign in to comment.