From 02a19e9a2940944a70bd940200f99e3d60910b2e Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 26 Apr 2026 13:24:05 +0200 Subject: [PATCH] Publish build jar to artifacts branch --- .gitea/workflows/build.yml | 40 ++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 174f5c1..76e145e 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -2,11 +2,14 @@ name: Build on: push: - branches: - - "**" + branches-ignore: + - artifacts pull_request: workflow_dispatch: +permissions: + contents: write + jobs: build: runs-on: ubuntu-latest @@ -27,9 +30,30 @@ jobs: - name: Build run: ./gradlew build --no-daemon - - name: Upload mod jar - uses: actions/upload-artifact@v3 - with: - name: worldhandler-1.21.1 - path: build/libs/*.jar - if-no-files-found: error + - name: Publish jar to artifacts branch + if: github.event_name != 'pull_request' + shell: bash + run: | + set -euo pipefail + + mkdir -p /tmp/worldhandler-artifacts + cp build/libs/*.jar /tmp/worldhandler-artifacts/ + + git config user.name "Gitea Actions" + git config user.email "actions@gitea.local" + + git fetch origin artifacts || true + git switch --force-create artifacts + git rm -rf . + + cp /tmp/worldhandler-artifacts/*.jar . + cat > README.md <<'EOF' + # WorldHandler build artifacts + + This branch is maintained by the Gitea runner. + Download the jar file from this branch. + EOF + + git add README.md *.jar + git commit --allow-empty -m "Publish WorldHandler jar from ${GITHUB_SHA}" + git push --force origin artifacts