Files
FindIt/.github/workflows/build.yml
TDLM patch bot 905e38d0f3
Build / build (push) Failing after 19s
Build / publish (push) Skipped
chore: initial Stratum patch layer over GTNewHorizons/FindIt
2026-11-15 22:37:33 +08:00

83 lines
2.7 KiB
YAML

name: Build
on:
push:
paths-ignore:
- '**.md'
- 'reports/**'
- '.github/ISSUE_TEMPLATE/**'
- '.gitignore'
pull_request:
workflow_dispatch:
inputs:
module-ref:
description: Commit to build (default is the dispatched ref)
required: false
default: ''
gradle-args:
description: Extra arguments for the upstream build
required: false
default: ''
publish:
description: Publish the package ('true' or 'false')
required: false
default: 'false'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}
# Organisation-wide Stratum settings (registry, group, runner routes) are organisation variables.
env:
STRATUM_PUBLISH_URL: ${{ vars.STRATUM_PUBLISH_URL }}
STRATUM_RESOLVE_URL: ${{ vars.STRATUM_RESOLVE_URL }}
STRATUM_GROUP_ID: ${{ vars.STRATUM_GROUP_ID }}
STRATUM_ROUTES: ${{ vars.STRATUM_ROUTES }}
STRATUM_LOCALE: ${{ vars.STRATUM_LOCALE }}
jobs:
build:
if: github.event_name != 'push' || github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ inputs.module-ref || github.sha }}
submodules: true
- uses: ./.github/actions/setup-build
- name: Build
env:
GRADLE_ARGS: ${{ inputs.gradle-args }}
run: ./gradlew applyPatches build --args="$GRADLE_ARGS --no-daemon --console=plain" --no-daemon --console=plain
publish:
# Runs only after the build above passed. The Maven credentials exist in this job and nowhere else,
# so a pull request build can never read them.
needs: build
if: ${{ github.event_name == 'push' || inputs.publish == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 30
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ inputs.module-ref || github.sha }}
submodules: true
- uses: ./.github/actions/setup-build
- name: Check the publish credentials
run: |
if [[ -z "$MAVEN_USER" || -z "$MAVEN_PASSWORD" ]]; then
echo "::error::MAVEN_USER and MAVEN_PASSWORD are not set; cannot publish"
exit 1
fi
- name: Publish
env:
GRADLE_ARGS: ${{ inputs.gradle-args }}
run: ./gradlew applyPatches publish --args="$GRADLE_ARGS --no-daemon --console=plain" --no-daemon --console=plain