Skip to content

Commit

Permalink
Added workflow & Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasDeBruijn committed Jun 13, 2021
1 parent a790f55 commit abc0036
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 7 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Java CI with Gradle

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.16
uses: actions/setup-java@v1
with:
java-version: 1.16

# Build with gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release on tag
on:
push:
tags:
- '**'

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Set output variables
id: export_vars
run: |
export RELEASE_UPLOAD_URL="${{ steps.create_release.outputs.upload_url }}"
echo "::set-output name=release_upload_url::${RELEASE_UPLOAD_URL}"
outputs:
release_upload_url: ${{ steps.export_vars.outputs.release_upload_url }}

build-java-11:
needs: create-release
runs-on: ubuntu-latest
steps:
#Checkout
- uses: actions/checkout@v2

#Setup Java 16
- name: Set up Java 16
uses: actions/setup-java@v1
with:
java-version: 1.16

#Apply permissions for Gradle, so that ./gradlew can run
- name: Grant execute permission for gradlew
run: chmod +x gradlew

#Build the JAR
- name: Build with Gradle
run: ./gradlew ghActions

#Extract version number
- name: Extract version number
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

#Extract repository name
- name: Extract repository name
run: echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" >> $GITHUB_ENV

#Attach compiled JAR to ReleaseS
- name: Attach JAR to Release
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
asset_path: actions/output.jar
asset_name: ${{ env.REPOSITORY_NAME }}-${{ env.RELEASE_VERSION }}-RELEASE.jar
asset_content_type: application/java-archive
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ releases
.settings
*/bin/*
bin/

actions/
17 changes: 11 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ shadowJar() {


task testJar(type: ShadowJar) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE

relocate 'net.dv8tion.jda', 'nl.thedutchmc.libs.jda'

description 'Build a test Jar'
archiveClassifier = 'DEV'
from sourceSets.main.output
Expand All @@ -77,13 +74,21 @@ processResources {
}

task releaseJar(type: ShadowJar) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE

relocate 'net.dv8tion.jda', 'nl.thedutchmc.libs.jda'

description 'Build a release Jar'
archiveClassifier = 'RELEASE'
from sourceSets.main.output
configurations = [project.configurations.runtimeClasspath]
destinationDirectory = file("$rootDir/releases")
}

task ghActions(type: ShadowJar) {
relocate 'net.dv8tion.jda', 'nl.thedutchmc.libs.jda'
description 'GitHub Actions task. Not used for regular development'
version = ''
archiveClassifier = ''
archiveBaseName = 'output'
from sourceSets.main.output
configurations = [project.configurations.runtimeClasspath]
destinationDirectory = file("$rootDir/actions")
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pluginVersion = 1.5.0
pluginVersion = 1.5.1
pluginGroup = nl.thedutchmc
pluginName = SkinFixer
pluginAuthor = TheDutchMC
Expand Down

0 comments on commit abc0036

Please sign in to comment.