diff --git a/.github/workflows/release_package.yml b/.github/workflows/release_package.yml new file mode 100644 index 000000000..6faedca59 --- /dev/null +++ b/.github/workflows/release_package.yml @@ -0,0 +1,39 @@ +name: Publish + +on: + push: + branches: + - master + +jobs: + + # Build the library + publish: + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-java@v1 + with: + java-version: 11 + + - uses: eskatos/gradle-command-action@v1 + with: + arguments: clean build buildRelease + + - uses: chadly/prod-env-variables@v1 + with: + keys: | + GHP_USERNAME + GHP_TOKEN + env: + GHP_USERNAME_PROD: ${{ github.actor }} + GHP_TOKEN_PROD: ${{ secrets.GITHUB_TOKEN }} + + - uses: eskatos/gradle-command-action@v1 + with: + arguments: publish diff --git a/build.gradle b/build.gradle index a5eee3ea0..626f640d3 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ buildscript { plugins { id "com.gradle.build-scan" version "3.4.1" id "java-library" + id "maven-publish" } // Load project dependancy configurations @@ -197,4 +198,24 @@ task buildBeta(type: Copy) { from "build/libs" into "_release/jar" include project.name + "-" + project.version +"-all.jar" +} + +// GitHub Packages config +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/frc5024/lib5k") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GHP_USERNAME") + password = project.findProperty("gpr.key") ?: System.getenv("GHP_TOKEN") + } + } + } + publications { + gpr(MavenPublication) { + dependsOn buildRelease + from "_release/"+project.name + "-" + project.version +"-all.jar" + } + } } \ No newline at end of file