Skip to content

Build task should actually build the application, not publish #1

Build task should actually build the application, not publish

Build task should actually build the application, not publish #1

# Based off https://github.com/MinecraftForge/SharedActions/blob/main/.github/workflows/gradle.yml
name: Gradle Pre-release CI
on:
workflow_call:
inputs:
java:
description: "The version of Java to use to run Gradle" # Note: Gradle's Java toolchains feature is used for compiling, which is separate from this
required: false
type: string
default: "21"
gradle_tasks:
description: "The Gradle task(s) to run for building"
required: false
type: string
default: "publish"
secrets:
GRADLE_ENCRYPTION_KEY:
description: The AES key to enable Gradle cache encryption
required: false
permissions:
contents: read
statuses: write
packages: write
jobs:
compute-version:
name: Compute version
runs-on: ubuntu-latest
steps:
- uses: ldtteam/operapublicacreator/.github/workflows/gradle.version.yaml@${{ github.workflow_sha }}
with:
suffix: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('branch-{0}', steps.computeBranchSuffix.outputs.branch_suffix) }}
gradle:
needs: [ "compute-version" ] # Make sure we now the version before starting to build
runs-on: ubuntu-latest
steps:
- id: checkout
name: "📦 Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true
- id: setupJava
name: "🔧 Setup Java"
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#java
# language=bash
run: |
echo "JAVA_HOME=$(echo $JAVA_HOME_${{ inputs.java }}_X64)" >> "$GITHUB_ENV"
- id: setupGradle
name: "🔧 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- id: build
name: "🏗️ Build"
run: ./gradlew --build-cache ${{ inputs.gradle_tasks }}
env:
Version: "${{ needs.compute-version.outputs.version }}"
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_USERNAME: ${{ github.actor }}