9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-19 14:59:21 +00:00

build: account for differences in commit version names

This commit is contained in:
William
2024-09-05 19:14:38 +01:00
parent 41b3240741
commit 2d5648408e
5 changed files with 83 additions and 32 deletions

70
.github/workflows/ci_1.20.1.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
name: CI Tests
on:
push:
branches: [ 'minecraft/1.20.1' ]
paths-ignore:
- 'docs/**'
- 'workflows/**'
- 'README.md'
permissions:
contents: read
checks: write
jobs:
build:
name: 'Build - 1.20.1'
runs-on: ubuntu-latest
steps:
- name: 'Setup JDK 21 📦'
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: 'Setup Gradle 8.8 🏗️'
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.8'
- name: 'Checkout for CI 🛎️'
uses: actions/checkout@v4
with:
ref: 'minecraft/1.20.1'
env:
SNAPSHOTS_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
SNAPSHOTS_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: '[Current - 1.20.1] Build 🛎️'
run: |
./gradlew clean build publish
- name: 'Publish Test Report 📊'
uses: mikepenz/action-junit-report@v4
if: success() || failure() # Continue on failure
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: 'Fetch Version String 📝'
run: |
echo "::set-output name=VERSION_NAME::$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
id: fetch-version
- name: 'Set Version Variable 📝'
run: |
echo "version_name=${{steps.fetch-version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
- name: 'Publish to William278.net 🚀'
uses: WiIIiam278/bones-publish-action@v1
with:
api-key: ${{ secrets.BONES_API_KEY }}
project: 'husksync'
channel: 'alpha'
version: ${{ env.version_name }}
changelog: ${{ github.event.head_commit.message }}
distro-names: |
paper-1.20.1
fabric-1.20.1
distro-groups: |
paper
fabric
distro-descriptions: |
Paper 1.20.1
Fabric 1.20.1
files: |
target/HuskSync-Paper-${{ env.version_name }}+mc.1.20.1.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.20.1.jar

View File

@@ -14,6 +14,7 @@ permissions:
jobs:
build:
name: 'Build - 1.21.1'
runs-on: ubuntu-latest
steps:
- name: 'Setup JDK 21 📦'
@@ -25,31 +26,14 @@ jobs:
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.8'
- name: '[Current - 1.21.1] Checkout for CI 🛎️'
- name: 'Checkout for CI 🛎️'
uses: actions/checkout@v4
with:
path: '1_21_1'
- name: '[LTS - 1.20.1] Checkout for CI 🛎️'
uses: actions/checkout@v4
with:
ref: 'minecraft/1.20.1'
path: '1_20_1'
env:
SNAPSHOTS_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
SNAPSHOTS_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: '[Current - 1.21.1] Build 🛎️'
run: |
mkdir target
cd 1_21_1
./gradlew clean build publish
cp -rf target/* ../target/
cd ..
- name: '[LTS - 1.20.1] Build 🛎️'
run: |
cd 1_20_1
./gradlew clean build publish
cp -rf target/* ../target/
cd ..
- name: 'Publish Test Report 📊'
uses: mikepenz/action-junit-report@v4
if: success() || failure() # Continue on failure
@@ -57,13 +41,11 @@ jobs:
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: 'Fetch Version String 📝'
run: |
cd 1_21_1
echo "::set-output name=VERSION_NAME::$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
id: fetch-version
- name: 'Set Version Variable 📝'
run: |
echo "version_name=${{steps.fetch-version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
cd ${{ github.workspace }}
- name: 'Publish to William278.net 🚀'
uses: WiIIiam278/bones-publish-action@v1
with:
@@ -75,20 +57,12 @@ jobs:
distro-names: |
paper-1.21.1
fabric-1.21.1
paper-1.20.1
fabric-1.20.1
distro-groups: |
paper
fabric
paper
fabric
distro-descriptions: |
Paper 1.21.1
Fabric 1.21.1
Paper 1.20.1
Fabric 1.20.1
files: |
target/HuskSync-Paper-${{ env.version_name }}+mc.1.21.1.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.21.1.jar
target/HuskSync-Paper-${{ env.version_name }}+mc.1.20.1.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.20.1.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.21.1.jar

View File

@@ -11,6 +11,7 @@ permissions:
jobs:
build:
name: 'Publish Release'
runs-on: ubuntu-latest
steps:
- name: 'Setup JDK 21 📦'
@@ -38,13 +39,13 @@ jobs:
run: |
mkdir target
cd 1_21_1
./gradlew clean build publish
./gradlew clean build publish -Dforce-hide-version-meta=1
cp -rf target/* ../target/
cd ..
- name: '[LTS - 1.20.1] Build 🛎️'
run: |
cd 1_20_1
./gradlew clean build publish
./gradlew clean build publish -Dforce-hide-version-meta=1
cp -rf target/* ../target/
cd ..
- name: 'Publish Test Report 📊'

View File

@@ -13,7 +13,8 @@ permissions:
contents: write
jobs:
deploy-wiki:
update-docs:
name: 'Update Docs'
runs-on: ubuntu-latest
steps:
- name: 'Checkout for CI 🛎️'

View File

@@ -196,6 +196,11 @@ logger.lifecycle("Building HuskSync ${version} by William278 for Minecraft ${min
@SuppressWarnings('GrMethodMayBeStatic')
def versionMetadata() {
// If the force-hide-version-meta environment variable is set, return ''
if (System.getenv('force-hide-version-meta') != null) {
return ''
}
// Require grgit
if (grgit == null) {
return '-unknown'