generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from boholder/auto-build-action
Add automatic package building GitHub Action. close #89
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Build Mod Packages | ||
on: | ||
push: | ||
# new commits are pushed onto these branches | ||
branches: | ||
- default | ||
- 1.20.x | ||
# OR commits are tagged with version tags | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
server-id: minecraft-access # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
|
||
- name: Set up Gradle | ||
uses: gradle/[email protected] | ||
with: | ||
arguments: wrapper | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@064a97fb0b4cef86a65f09898c572382f3af10e0 | ||
|
||
- name: Build Fabric with Gradle | ||
uses: gradle/[email protected] | ||
with: | ||
arguments: :fabric:build | ||
|
||
- name: Build Forge with Gradle | ||
uses: gradle/[email protected] | ||
with: | ||
arguments: :forge:build | ||
|
||
- name: Move and Rename Mod Files | ||
run: | | ||
mkdir -p ./upload | ||
pushd . | ||
cd ./fabric/build/libs | ||
rm minecraft-access-*-dev-shadow.jar minecraft-access-*-sources.jar | ||
mv minecraft-access*.jar $(basename -s .jar -a *)-fabric.jar | ||
popd | ||
pushd . | ||
cd ./forge/build/libs | ||
rm minecraft-access-*-dev-shadow.jar minecraft-access-*-sources.jar | ||
mv minecraft-access*.jar $(basename -s .jar -a *)-forge.jar | ||
popd | ||
cp ./fabric/build/libs/minecraft-access*-fabric.jar ./upload | ||
cp ./forge/build/libs/minecraft-access*-forge.jar ./upload | ||
- name: Get Current Time | ||
run: echo "BUILD_TIME=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV | ||
|
||
# Then we can download them from workflow result page | ||
- name: Upload Packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: minecraft-access-mod-${{ env.BUILD_TIME }} | ||
path: ./upload |