From f0298601680fa94a17977af5483c06fde1fc26b0 Mon Sep 17 00:00:00 2001 From: piebot Date: Fri, 27 Mar 2026 18:22:23 +0300 Subject: [PATCH 1/2] try forgejo actions --- .gitea/workflows/nightly.yml | 163 +++++++++++++++++++++++++++++++++++ flake.nix | 3 + 2 files changed, 166 insertions(+) create mode 100644 .gitea/workflows/nightly.yml diff --git a/.gitea/workflows/nightly.yml b/.gitea/workflows/nightly.yml new file mode 100644 index 00000000..25d759d1 --- /dev/null +++ b/.gitea/workflows/nightly.yml @@ -0,0 +1,163 @@ +name: Nightly Release + +on: + workflow_dispatch: + push: + branches: + - 'main' + paths-ignore: + - '.gitignore' + - '*.md' + - '.gitea/**' + - '!.gitea/workflows/nightly.yml' + +permissions: + contents: write + +concurrency: + group: nightly + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Nix + uses: https://github.com/cachix/install-nix-action@v27 + with: + extra_nix_config: | + experimental-features = nix-command flakes + accept-flake-config = true + + # Caches the Nix store so the Windows SDK fixed-output derivation + # (downloaded via xwin) is not re-fetched on every run. + - name: Cache Nix store + uses: actions/cache@v4 + with: + path: | + ~/.cache/nix + /nix/store + /nix/var/nix/db + /nix/var/nix/gcroots + key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }} + restore-keys: | + nix-${{ runner.os }}- + + - name: Build + run: nix build .#unwrapped --out-link result-unwrapped + + - name: Package artifacts + run: | + mkdir -p staging + + # Client zip (full runtime) + cd result-unwrapped/client + zip -r ../../staging/LCEWindows64.zip . + # Standalone exe for quick updates + cp Minecraft.Client.exe ../../staging/ + cd ../.. + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-windows64 + path: staging/* + + release: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + merge-multiple: true + + - name: Publish nightly release + env: + FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + + API="${{ github.server_url }}/api/v1" + REPO="${{ github.repository }}" + TAG="nightly" + AUTH="Authorization: token $FORGEJO_TOKEN" + + # Check whether the nightly tag/release already exists + HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "$AUTH" \ + "$API/repos/$REPO/releases/tags/$TAG") + + if [[ "$HTTP_STATUS" == "200" ]]; then + echo "[info] Updating existing nightly release..." + RELEASE=$(curl -s -H "$AUTH" "$API/repos/$REPO/releases/tags/$TAG") + RELEASE_ID=$(echo "$RELEASE" | jq -r '.id') + + # Wipe all existing assets so the release stays current + ASSETS=$(curl -s -H "$AUTH" "$API/repos/$REPO/releases/$RELEASE_ID/assets") + for ASSET_ID in $(echo "$ASSETS" | jq -r '.[].id'); do + curl -s -X DELETE -H "$AUTH" \ + "$API/repos/$REPO/releases/$RELEASE_ID/assets/$ASSET_ID" + done + + # Update release metadata + curl -s -X PATCH \ + -H "$AUTH" -H "Content-Type: application/json" \ + "$API/repos/$REPO/releases/$RELEASE_ID" \ + -d '{ + "name": "Nightly Client Release", + "prerelease": true, + "body": "Requires at least Windows 7 and a DirectX 11 compatible GPU.\n\n# \ud83d\udea8 First time here? \ud83d\udea8\nDownload `LCEWindows64.zip` and extract it to the folder where you want to keep the game. The other files are already inside the `.zip`!" + }' + else + echo "[info] Creating new nightly release..." + RELEASE=$(curl -s -X POST \ + -H "$AUTH" -H "Content-Type: application/json" \ + "$API/repos/$REPO/releases" \ + -d '{ + "tag_name": "'"$TAG"'", + "name": "Nightly Client Release", + "prerelease": true, + "body": "Requires at least Windows 7 and a DirectX 11 compatible GPU.\n\n# \ud83d\udea8 First time here? \ud83d\udea8\nDownload `LCEWindows64.zip` and extract it to the folder where you want to keep the game. The other files are already inside the `.zip`!" + }') + RELEASE_ID=$(echo "$RELEASE" | jq -r '.id') + fi + + echo "[info] Uploading assets to release $RELEASE_ID..." + for FILE in artifacts/*; do + FILENAME=$(basename "$FILE") + echo "[info] -> $FILENAME" + curl -s -X POST \ + -H "$AUTH" \ + -F "attachment=@$FILE;filename=$FILENAME" \ + "$API/repos/$REPO/releases/$RELEASE_ID/assets" > /dev/null + done + echo "[info] Done." + + cleanup: + needs: [build, release] + if: always() + runs-on: ubuntu-latest + steps: + - name: Delete build artifacts + env: + FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + API="${{ github.server_url }}/api/v1" + REPO="${{ github.repository }}" + AUTH="Authorization: token $FORGEJO_TOKEN" + + ARTIFACTS=$(curl -s -H "$AUTH" \ + "$API/repos/$REPO/actions/artifacts?name=build-windows64") + + for ARTIFACT_ID in $(echo "$ARTIFACTS" | jq -r '.artifacts[].id // empty'); do + echo "[info] Deleting artifact $ARTIFACT_ID" + curl -s -X DELETE -H "$AUTH" \ + "$API/repos/$REPO/actions/artifacts/$ARTIFACT_ID" + done \ No newline at end of file diff --git a/flake.nix b/flake.nix index eef59c57..7f474e86 100644 --- a/flake.nix +++ b/flake.nix @@ -158,7 +158,10 @@ cp build/Minecraft.Client/Minecraft.Client.exe $out/client/ cp build/Minecraft.Client/iggy_w64.dll $out/client/ 2>/dev/null || true cp -r build/Minecraft.Client/Common $out/client/ 2>/dev/null || true + cp -r build/Minecraft.Client/music $out/client/ 2>/dev/null || true cp -r build/Minecraft.Client/Windows64 $out/client/ 2>/dev/null || true + cp -r build/Minecraft.Client/Windows64Media $out/client/ 2>/dev/null || true + cp -r build/Minecraft.Client/iggy* $out/client/ 2>/dev/null || true # Install server cp build/Minecraft.Server/Minecraft.Server.exe $out/server/ From d49d1ae79f4577d748508e98a20b71983f08f153 Mon Sep 17 00:00:00 2001 From: piebot Date: Fri, 27 Mar 2026 16:27:19 +0100 Subject: [PATCH 2/2] revert f0298601680fa94a17977af5483c06fde1fc26b0 revert try forgejo actions --- .gitea/workflows/nightly.yml | 163 ----------------------------------- flake.nix | 3 - 2 files changed, 166 deletions(-) delete mode 100644 .gitea/workflows/nightly.yml diff --git a/.gitea/workflows/nightly.yml b/.gitea/workflows/nightly.yml deleted file mode 100644 index 25d759d1..00000000 --- a/.gitea/workflows/nightly.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: Nightly Release - -on: - workflow_dispatch: - push: - branches: - - 'main' - paths-ignore: - - '.gitignore' - - '*.md' - - '.gitea/**' - - '!.gitea/workflows/nightly.yml' - -permissions: - contents: write - -concurrency: - group: nightly - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Nix - uses: https://github.com/cachix/install-nix-action@v27 - with: - extra_nix_config: | - experimental-features = nix-command flakes - accept-flake-config = true - - # Caches the Nix store so the Windows SDK fixed-output derivation - # (downloaded via xwin) is not re-fetched on every run. - - name: Cache Nix store - uses: actions/cache@v4 - with: - path: | - ~/.cache/nix - /nix/store - /nix/var/nix/db - /nix/var/nix/gcroots - key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }} - restore-keys: | - nix-${{ runner.os }}- - - - name: Build - run: nix build .#unwrapped --out-link result-unwrapped - - - name: Package artifacts - run: | - mkdir -p staging - - # Client zip (full runtime) - cd result-unwrapped/client - zip -r ../../staging/LCEWindows64.zip . - # Standalone exe for quick updates - cp Minecraft.Client.exe ../../staging/ - cd ../.. - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: build-windows64 - path: staging/* - - release: - needs: build - runs-on: ubuntu-latest - - steps: - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - path: artifacts - merge-multiple: true - - - name: Publish nightly release - env: - FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -euo pipefail - - API="${{ github.server_url }}/api/v1" - REPO="${{ github.repository }}" - TAG="nightly" - AUTH="Authorization: token $FORGEJO_TOKEN" - - # Check whether the nightly tag/release already exists - HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ - -H "$AUTH" \ - "$API/repos/$REPO/releases/tags/$TAG") - - if [[ "$HTTP_STATUS" == "200" ]]; then - echo "[info] Updating existing nightly release..." - RELEASE=$(curl -s -H "$AUTH" "$API/repos/$REPO/releases/tags/$TAG") - RELEASE_ID=$(echo "$RELEASE" | jq -r '.id') - - # Wipe all existing assets so the release stays current - ASSETS=$(curl -s -H "$AUTH" "$API/repos/$REPO/releases/$RELEASE_ID/assets") - for ASSET_ID in $(echo "$ASSETS" | jq -r '.[].id'); do - curl -s -X DELETE -H "$AUTH" \ - "$API/repos/$REPO/releases/$RELEASE_ID/assets/$ASSET_ID" - done - - # Update release metadata - curl -s -X PATCH \ - -H "$AUTH" -H "Content-Type: application/json" \ - "$API/repos/$REPO/releases/$RELEASE_ID" \ - -d '{ - "name": "Nightly Client Release", - "prerelease": true, - "body": "Requires at least Windows 7 and a DirectX 11 compatible GPU.\n\n# \ud83d\udea8 First time here? \ud83d\udea8\nDownload `LCEWindows64.zip` and extract it to the folder where you want to keep the game. The other files are already inside the `.zip`!" - }' - else - echo "[info] Creating new nightly release..." - RELEASE=$(curl -s -X POST \ - -H "$AUTH" -H "Content-Type: application/json" \ - "$API/repos/$REPO/releases" \ - -d '{ - "tag_name": "'"$TAG"'", - "name": "Nightly Client Release", - "prerelease": true, - "body": "Requires at least Windows 7 and a DirectX 11 compatible GPU.\n\n# \ud83d\udea8 First time here? \ud83d\udea8\nDownload `LCEWindows64.zip` and extract it to the folder where you want to keep the game. The other files are already inside the `.zip`!" - }') - RELEASE_ID=$(echo "$RELEASE" | jq -r '.id') - fi - - echo "[info] Uploading assets to release $RELEASE_ID..." - for FILE in artifacts/*; do - FILENAME=$(basename "$FILE") - echo "[info] -> $FILENAME" - curl -s -X POST \ - -H "$AUTH" \ - -F "attachment=@$FILE;filename=$FILENAME" \ - "$API/repos/$REPO/releases/$RELEASE_ID/assets" > /dev/null - done - echo "[info] Done." - - cleanup: - needs: [build, release] - if: always() - runs-on: ubuntu-latest - steps: - - name: Delete build artifacts - env: - FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - API="${{ github.server_url }}/api/v1" - REPO="${{ github.repository }}" - AUTH="Authorization: token $FORGEJO_TOKEN" - - ARTIFACTS=$(curl -s -H "$AUTH" \ - "$API/repos/$REPO/actions/artifacts?name=build-windows64") - - for ARTIFACT_ID in $(echo "$ARTIFACTS" | jq -r '.artifacts[].id // empty'); do - echo "[info] Deleting artifact $ARTIFACT_ID" - curl -s -X DELETE -H "$AUTH" \ - "$API/repos/$REPO/actions/artifacts/$ARTIFACT_ID" - done \ No newline at end of file diff --git a/flake.nix b/flake.nix index 7f474e86..eef59c57 100644 --- a/flake.nix +++ b/flake.nix @@ -158,10 +158,7 @@ cp build/Minecraft.Client/Minecraft.Client.exe $out/client/ cp build/Minecraft.Client/iggy_w64.dll $out/client/ 2>/dev/null || true cp -r build/Minecraft.Client/Common $out/client/ 2>/dev/null || true - cp -r build/Minecraft.Client/music $out/client/ 2>/dev/null || true cp -r build/Minecraft.Client/Windows64 $out/client/ 2>/dev/null || true - cp -r build/Minecraft.Client/Windows64Media $out/client/ 2>/dev/null || true - cp -r build/Minecraft.Client/iggy* $out/client/ 2>/dev/null || true # Install server cp build/Minecraft.Server/Minecraft.Server.exe $out/server/