Skip to content

Commit

Permalink
Setup beta program
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Nov 9, 2019
1 parent 3698081 commit e5b0da9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,26 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Setup CI Workspace
run: ./gradlew setupCIWorkspace
- name: Build with Gradle
run: ./gradlew build
id: build
run: ./gradlew setupGithubActions build
- name: Create a Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: alpha-${{ steps.build.outputs.version }}
release_name: betteranimalsplus-alpha-${{ steps.build.outputs.version }}
draft: false
prerelease: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/betteranimalsplus-${{ steps.build.outputs.version }}.jar
asset_name: betteranimalsplus-${{ steps.build.outputs.version }}.jar
asset_content_type: application/java-archive
18 changes: 18 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ buildscript {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
plugins {
id 'org.ajoberstar.grgit' version '3.1.1'
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

Expand Down Expand Up @@ -84,6 +87,21 @@ tasks.withType(JavaCompile) {
]
}

task setupGithubActions(type: Exec) {
def getVersion = {
//TAG-offset-hash
def raw = grgit.describe(longDescr: true, tags:true, match: ["[1-9].[0-9].[0-9]", "[1-9][0-9].[1-9][0-9].[1-9][0-9]", "[0-9].[1-9][0-9].[1-9][0-9]", "[0-9].[0-9].[1-9][0-9]", "[0-9].[1-9][0-9].[0-9]", "[1-9][0-9].[0-9].[0-9]"])
def desc = (raw == null ? '0.0-0-unknown' : grgit.describe(longDescr: true, tags:true, match: ["[1-9].[0-9].[0-9]", "[1-9][0-9].[1-9][0-9].[1-9][0-9]", "[0-9].[1-9][0-9].[1-9][0-9]", "[0-9].[0-9].[1-9][0-9]", "[0-9].[1-9][0-9].[0-9]", "[1-9][0-9].[0-9].[0-9]"])).split('-') as List
def hash = desc.remove(desc.size() - 1)
def offset = desc.remove(desc.size() - 1)
def tag = desc.join('-')
return "${tag}.${offset}".toString() //Bake the response instead of making it dynamic
}
project.mod_version = getVersion();
version = "${project.mc_version}-${project.mod_version}";
commandLine "echo", "##[set-output name=version;]${project.version}"
}

processResources {
inputs.property "version", "${project.mod_version}"
inputs.property "mcversion", project.minecraft.version
Expand Down

0 comments on commit e5b0da9

Please sign in to comment.