CI
All checks were successful
Build and Release / build (push) Successful in 4m5s

This commit is contained in:
2026-04-06 17:49:20 -05:00
parent 08bd2aa272
commit 96792a0091

View File

@@ -1,4 +1,4 @@
name: Main Release
name: Build and Release
on:
push:
@@ -6,6 +6,7 @@ on:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:
permissions:
@@ -15,6 +16,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: gradle:8.11.1-jdk21
env:
GITEA_TOKEN: ${{ github.token }}
GITEA_API_URL: ${{ github.server_url }}/api/v1
@@ -22,46 +24,22 @@ jobs:
GITEA_REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
GITEA_REF_NAME: ${{ github.ref_name }}
GITEA_SHA: ${{ github.sha }}
GRADLE_USER_HOME: ${{ github.workspace }}/.gradle-home
steps:
- name: Prepare source
shell: bash
run: |
set -euo pipefail
if [ ! -f build.gradle ] && [ ! -f build.gradle.kts ]; then
if [ ! -f build.gradle ]; then
git -c http.extraHeader="Authorization: token ${GITEA_TOKEN}" \
clone --depth 1 "${GITEA_REPO_URL}" .
fi
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
.gradle-home/caches
.gradle-home/daemon
.gradle-home/native
.gradle-home/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties', '**/settings.gradle*', '**/libs.versions.toml') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Make wrapper executable
shell: bash
run: chmod +x ./gradlew
- name: Build
shell: bash
run: |
set -euo pipefail
./gradlew remapJar --build-cache --parallel --stacktrace
gradle --no-daemon build
- name: Publish Gitea release
if: github.event_name != 'pull_request'
@@ -69,12 +47,7 @@ jobs:
run: |
set -euo pipefail
jar_path="$(find build/libs -maxdepth 1 -type f -name '*.jar' ! -name '*-sources.jar' | head -n 1)"
if [ -z "${jar_path}" ]; then
echo "No release jar found in build/libs"
exit 1
fi
jar_path="$(ls -1 build/libs/*.jar | head -n 1)"
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
release_tag="${GITEA_REF_NAME}"
release_name="${GITEA_REF_NAME}"
@@ -103,5 +76,6 @@ jobs:
curl -fsS \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@${jar_path}" \
"${GITEA_API_URL}/repos/${GITEA_REPO}/releases/${release_id}/assets?name=$(basename "${jar_path}")"