Skip to content

Commit

Permalink
Add CI versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
wtlgo committed Jul 25, 2022
1 parent 57b2924 commit 276ef87
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Java CI

on: [push]
on: [ push ]

jobs:
build:
Expand All @@ -13,24 +13,27 @@ jobs:
java-version: '17'
distribution: 'adopt'

- name: Get Commit Data
id: commit
uses: pr-mpt/actions-commit-hash@v1

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Change wrapper permissions
- name: Change Wrapper Permissions
run: chmod +x ./gradlew

- name: Setup Gradle
- name: Gradle Build
uses: gradle/gradle-build-action@v2

- name: Execute Gradle Shaded Build
run: ./gradlew shadowJar

- id: commit
uses: pr-mpt/actions-commit-hash@v1
with:
arguments: shadowJar --scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: dev-${{ steps.commit.outputs.short }}

- uses: actions/upload-artifact@v3
with:
name: MikChanNoChat-${{ steps.commit.outputs.short }}.zip
name: MikChanNoChat-dev-${{ steps.commit.outputs.short }}.zip
path: |
build/libs/
LICENSE.txt
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
publish:
runs-on: ubuntu-latest

permissions:
permissions:
contents: read
packages: write
packages: write

steps:
- uses: actions/checkout@v3
Expand Down
18 changes: 15 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@ plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}

if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}

static def determineVersion(String defaultVersion) {
def envVersion = System.getenv("VERSION")
return envVersion == null ? defaultVersion : envVersion
}

group = 'dev.mikchan.mcnp'
version = '1.0.4'
version = determineVersion('1.0.4')

repositories {
mavenCentral()
Expand All @@ -18,8 +30,8 @@ repositories {
}

maven {
name 'placeholderapi'
url 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
name = 'placeholderapi'
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}

Expand Down

0 comments on commit 276ef87

Please # to comment.