Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

GitHub actions changes #21

Merged
merged 13 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 30 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
name: Java CI

on: [push]
on:
Derongan marked this conversation as resolved.
Show resolved Hide resolved
push:
branches-ignore:
- master
paths-ignore:
- .gitignore
- README.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth ignoring **.md?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id prefer not to for now just in case. if it starts being annoying can change

- geary.iml

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- run: cat $HOME/.m2/settings.xml
- uses: derongan/nmsaction@v1
with:
rev: 1.15.1
- name: Install nms into m2
run: mkdir -p $HOME/.m2/repository && cp -a nms-build/.m2/repository/. $HOME/.m2/repository
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew -PbuildNo=${{ github.run_number }} shadowJar
- name: Upload artifact
uses: actions/upload-artifact@v1.0.0
with:
name: package
path: build/libs
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build NMS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No cache? :(

I'd like it if we could figure out a better way of doing it than I have with Mobzy. I wonder if it'd be possible to get that working right in the NMS action itself. The only actual problem with the way I did it is it relies on NMS version being in gradle.properties and will update cache any time properties are updated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seeing as this change is focused on releasing, no

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but I'd like to look into that later. An issue would be nice, but what repo would that belong to? I think best to put it under the nms action itself, since we should probably add some info the the README on caching anyways.

uses: derongan/nmsaction@v1
with:
rev: 1.15.1
- name: Install nms into m2
run: mkdir -p $HOME/.m2/repository && cp -a nms-build/.m2/repository/. $HOME/.m2/repository
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests
run: ./gradlew test
- name: Build with Gradle
run: ./gradlew -PbuildNo=${{ github.run_number }} jar shadowJar
- name: Upload artifact
uses: actions/upload-artifact@v1.0.0
with:
name: package
path: build/libs
29 changes: 29 additions & 0 deletions .github/workflows/pr-has-version-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check PR Has Version Label

on:
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]
paths-ignore:
- .gitignore
- README.md
- geary.iml
- .github/workflows/**

jobs:
check-has-version-label:
runs-on: ubuntu-latest
steps:
- name: Find change type
id: bump
uses: zwaldowski/match-label-action@v1
with:
allowed: major,minor,patch
- uses: zwaldowski/semver-release-action@v1
id: next_version
with:
bump: ${{ steps.bump.outputs.match }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
prefix: v
- name: Show Version
run: echo Next version at time of running this action will be ${{ steps.next_version.outputs.version }}
30 changes: 0 additions & 30 deletions .github/workflows/publish-snapshot.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish Release

on:
push:
branches:
- master
paths-ignore:
- .gitignore
- README.md
- geary.iml
- .github/workflows/**

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build NMS
uses: derongan/nmsaction@v1
lizelive marked this conversation as resolved.
Show resolved Hide resolved
with:
rev: 1.15.1
- name: Install nms into m2
run: mkdir -p $HOME/.m2/repository && cp -a nms-build/.m2/repository/. $HOME/.m2/repository
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests
run: ./gradlew test
- name: Find change type
id: bump
uses: zwaldowski/match-label-action@v1
with:
allowed: major,minor,patch
- uses: zwaldowski/semver-release-action@v1
lizelive marked this conversation as resolved.
Show resolved Hide resolved
id: next_version
with:
bump: ${{ steps.bump.outputs.match }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prefix: v
- name: Build output jars
run: ./gradlew -Pversion=${{ steps.next_version.outputs.version }} jar shadowJar
- name: Upload artifact
uses: actions/upload-artifact@v1.0.0
with:
name: package
path: build/libs
- name: Publish to GitHub Package Repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew -Pversion=${{ steps.next_version.outputs.version }} publish
- name: Create GitHub Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
build/libs/*.jar

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not just the shadow jar?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. My thinking was there is no harm in releasing both. The non shaded jar may be useful for explicitly adding a dependency when developing outside of gradle.


30 changes: 9 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ plugins {

apply plugin: "com.github.johnrengelman.shadow"

group = pluginGroup
version = pluginVersion
group = "com.mineinabyss"

if (project.hasProperty("buildNo")) {
version += "-" + buildNo
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
mavenCentral()
mavenLocal()
Expand All @@ -35,11 +32,6 @@ repositories {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}

maven {
name = "papermc"
url = "https://papermc.io/repo/repository/maven-public/"
}
}

publishing {
Expand Down Expand Up @@ -67,7 +59,6 @@ dependencies {
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:3.2.4"
testImplementation group: 'org.spigotmc', name: 'spigot', version: '1.15.1-R0.1-SNAPSHOT'
testImplementation "org.reflections:reflections:0.9.12"
testImplementation "com.google.truth:truth:1.0.1"
annotationProcessor "com.google.auto.value:auto-value:1.7"
}
Expand All @@ -80,12 +71,9 @@ processResources {
}
}

//Move into plugins folder
if (project.hasProperty("plugin_path") && plugin_path) {
println("Copying to plugin directory $plugin_path")
task copyJar(type: Copy) {
from shadowJar // here it automatically reads jar file produced from jar task
into plugin_path
}
build.dependsOn copyJar
task copyJar(type: Copy) {
def plugin_path = project.findProperty("plugin_path")
0ffz marked this conversation as resolved.
Show resolved Hide resolved
inputs.property 'plugin_path', plugin_path
from shadowJar // here it automatically reads jar file produced from shadowJar task
into plugin_path
}
2 changes: 0 additions & 2 deletions gradle.properties

This file was deleted.