Skip to content

Commit 9cb5bce

Browse files
committed
Add github actions
1 parent 87e8b1e commit 9cb5bce

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

.github/workflows/gradle.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Java CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up JDK 11
13+
uses: actions/setup-java@v1
14+
with:
15+
java-version: 11
16+
- name: Grant execute permission for gradlew
17+
run: chmod +x gradlew
18+
- name: Build with Gradle
19+
run: ./gradlew build

.github/workflows/gradlepublish.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java#publishing-using-gradle
3+
4+
name: Publish Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 11
21+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
22+
settings-path: ${{ github.workspace }} # location for the settings.xml file
23+
24+
- name: Build with Gradle
25+
run: gradle build
26+
27+
# The USERNAME and PASSWORD need to correspond to the credentials environment variables used in
28+
# the publishing section of your build.gradle
29+
- name: Publish to GitHub Packages
30+
run: gradle publish
31+
env:
32+
USERNAME: ${{ github.actor }}
33+
PASSWORD: ${{ secrets.GITHUB_TOKEN }}

build.gradle

+20
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
apply plugin: 'java'
2+
apply plugin: 'maven'
3+
apply plugin: 'maven-publish'
24

35
group 'com.panguengine'
46
version '1.0.0'
57

68
sourceCompatibility = targetCompatibility = 11
79

10+
publishing {
11+
repositories {
12+
maven {
13+
name = "GitHubPackages"
14+
url = uri("https://maven.pkg.github.com/UnknownDomainGame/PBDF")
15+
credentials {
16+
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
17+
password = project.findProperty("gpr.key") ?: System.getenv("PASSWORD")
18+
}
19+
}
20+
}
21+
publications {
22+
gpr(MavenPublication) {
23+
from(components.java)
24+
}
25+
}
26+
}
27+
828
repositories {
929
jcenter()
1030
mavenCentral()

0 commit comments

Comments
 (0)