Skip to content

Commit

Permalink
build: account for differences in commit version names
Browse files Browse the repository at this point in the history
(cherry picked from commit 2d56484)
  • Loading branch information
WiIIiam278 committed Sep 5, 2024
1 parent 95f4782 commit b9b510f
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 32 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/ci_1.20.1.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 3 additions & 29 deletions .github/workflows/ci.yml → .github/workflows/ci_1.21.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ permissions:

jobs:
build:
name: 'Build - 1.21.1'
runs-on: ubuntu-latest
steps:
- name: 'Setup JDK 21 📦'
Expand All @@ -25,45 +26,26 @@ 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
with:
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:
Expand All @@ -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
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ permissions:

jobs:
build:
name: 'Publish Release'
runs-on: ubuntu-latest
steps:
- name: 'Setup JDK 21 📦'
Expand Down Expand Up @@ -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 📊'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ permissions:
contents: write

jobs:
deploy-wiki:
update-docs:
name: 'Update Docs'
runs-on: ubuntu-latest
steps:
- name: 'Checkout for CI 🛎️'
Expand Down
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,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'
Expand Down

0 comments on commit b9b510f

Please sign in to comment.