Skip to content

v0.5.1

v0.5.1 #30

Workflow file for this run

name: Create Release Assets
# Trigger the workflow only when a release is published
on:
release:
types: [published] # Only run when a release goes from draft/pre-release to published, or is created as published
permissions:
contents: write # Allow workflow to write release assets
jobs:
build-and-upload:
runs-on: ubuntu-latest
steps:
# 1. Checkout Repository code
- name: Checkout code at release tag
uses: actions/checkout@v4
# 2. Set up JDK (Must match the version used for building)
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# 3. Give permission to gradle to execute commands
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# Setup Gradle - This action handles caching and executing gradle tasks
# It automatically finds and uses ./gradlew
- name: Setup Gradle and Build Plugin Jar
uses: gradle/actions/setup-gradle@v4 # Use v4 or latest stable version
# Gradle with the new updates doesn't support arguments
- name: Build Bukkit, Velocity and BungeeCord jar
run: ./gradlew shadowJar
- name: Build fabric jar
run: ./gradlew fabric:build
# 5. Find the Bukkit Shadow Jar file and extract its name
- name: Find Bukkit Shadow Jar and Extract Name
id: find_bukkit_jar
run: |
JAR_PATH=$(find bukkit/build/libs -maxdepth 1 -name '*.jar' -printf "%s %p\n" | sort -nr | head -n 1 | awk '{print $2}')
if [ -z "$JAR_PATH" ]; then
echo "Error: Could not find the shadow JAR file in bukkit/build/libs/"
exit 1
fi
JAR_FILENAME=$(basename "$JAR_PATH")
echo "Found JAR path: $JAR_PATH"
echo "Found JAR filename: $JAR_FILENAME"
echo "path=$JAR_PATH" >> $GITHUB_OUTPUT
echo "filename=$JAR_FILENAME" >> $GITHUB_OUTPUT
shell: bash
# 6. Find the Velocity Shadow Jar file and extract its name
- name: Find Velocity Shadow Jar and Extract Name
id: find_velocity_jar
run: |
JAR_PATH=$(find velocity/build/libs -maxdepth 1 -name '*.jar' -printf "%s %p\n" | sort -nr | head -n 1 | awk '{print $2}')
if [ -z "$JAR_PATH" ]; then
echo "Error: Could not find the shadow JAR file in velocity/build/libs/"
exit 1
fi
JAR_FILENAME=$(basename "$JAR_PATH")
echo "Found JAR path: $JAR_PATH"
echo "Found JAR filename: $JAR_FILENAME"
echo "path=$JAR_PATH" >> $GITHUB_OUTPUT
echo "filename=$JAR_FILENAME" >> $GITHUB_OUTPUT
shell: bash
# 7. Find the BungeeCord Shadow Jar file and extract its name
- name: Find BungeeCord Shadow Jar and Extract Name
id: find_bungeecord_jar
run: |
JAR_PATH=$(find bungeecord/build/libs -maxdepth 1 -name '*.jar' -printf "%s %p\n" | sort -nr | head -n 1 | awk '{print $2}')
if [ -z "$JAR_PATH" ]; then
echo "Error: Could not find the shadow JAR file in bungeecord/build/libs/"
exit 1
fi
JAR_FILENAME=$(basename "$JAR_PATH")
echo "Found JAR path: $JAR_PATH"
echo "Found JAR filename: $JAR_FILENAME"
echo "path=$JAR_PATH" >> $GITHUB_OUTPUT
echo "filename=$JAR_FILENAME" >> $GITHUB_OUTPUT
shell: bash
# 8. Find the Fabric Jar file and extract its name
- name: Find Fabric Jar and Extract Name
id: find_fabric_jar
run: |
JAR_PATH=$(find fabric/build/libs -maxdepth 1 -name 'serverpulse-*.jar' -printf "%s %p\n" | sort -nr | head -n 1 | awk '{print $2}')
if [ -z "$JAR_PATH" ]; then
echo "Error: Could not find the shadow JAR file in fabric/build/libs/"
exit 1
fi
JAR_FILENAME=$(basename "$JAR_PATH")
echo "Found JAR path: $JAR_PATH"
echo "Found JAR filename: $JAR_FILENAME"
echo "path=$JAR_PATH" >> $GITHUB_OUTPUT
echo "filename=$JAR_FILENAME" >> $GITHUB_OUTPUT
shell: bash
# 9. Upload the Bukkit Shadow Jar as a release asset
- name: Upload Bukkit Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions automatically
file: ${{ steps.find_bukkit_jar.outputs.path }} # The path to the JAR found in the previous step
asset_name: ${{ steps.find_bukkit_jar.outputs.filename }} # Use the filename extracted earlier
tag: ${{ github.ref }} # The git tag associated with the release that triggered the workflow
overwrite: true # Optional: Replace asset with the same name if it already exists
# 10. Upload the Velocity Shadow Jar as a release asset
- name: Upload Velocity Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions automatically
file: ${{ steps.find_velocity_jar.outputs.path }} # The path to the JAR found in the previous step
asset_name: ${{ steps.find_velocity_jar.outputs.filename }} # Use the filename extracted earlier
tag: ${{ github.ref }} # The git tag associated with the release that triggered the workflow
overwrite: true # Optional: Replace asset with the same name if it already exists
# 11. Upload the BungeeCord Shadow Jar as a release asset
- name: Upload BungeeCord Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions automatically
file: ${{ steps.find_bungeecord_jar.outputs.path }} # The path to the JAR found in the previous step
asset_name: ${{ steps.find_bungeecord_jar.outputs.filename }} # Use the filename extracted earlier
tag: ${{ github.ref }} # The git tag associated with the release that triggered the workflow
overwrite: true # Optional: Replace asset with the same name if it already exists
# 12. Upload the Fabric Jar as a release asset
- name: Upload Fabric Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions automatically
file: ${{ steps.find_fabric_jar.outputs.path }} # The path to the JAR found in the previous step
asset_name: ${{ steps.find_fabric_jar.outputs.filename }} # Use the filename extracted earlier
tag: ${{ github.ref }} # The git tag associated with the release that triggered the workflow
overwrite: true # Optional: Replace asset with the same name if it already exists