Skip to content

Commit

Permalink
add build and publish actions
Browse files Browse the repository at this point in the history
  • Loading branch information
YanisBft committed Dec 31, 2023
1 parent da9eed1 commit 8cf7206
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: Java CI
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java: [18]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
- name: Make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Automatically publish the project to GitHub Packages for every published release.

name: Publish to GitHub Packages
on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'adopt'
- name: Make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 21 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}

Expand All @@ -16,7 +17,6 @@ repositories {
}

configurations {
include
include.canBeResolved = true
compileOnly.extendsFrom(include)
}
Expand All @@ -31,6 +31,8 @@ build {

shadowJar {
configurations = [project.configurations.include]

archiveFileName = "${archivesBaseName}-${version}.jar"
}

tasks.withType(JavaCompile).configureEach {
Expand All @@ -45,3 +47,21 @@ processResources {
)
}
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/PeaceAndCubeMC/PACFirstPlayed"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pacfirstplayed_group = fr.peaceandcube
pacfirstplayed_name = pacfirstplayed
pacfirstplayed_version = 1.3.0
pacfirstplayed_version = 1.3.1-SNAPSHOT

paper_version = 1.19.4-R0.1-SNAPSHOT
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'PACFirstPlayed'
rootProject.name = 'pacfirstplayed'

0 comments on commit 8cf7206

Please sign in to comment.