Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46ea914b84 | ||
|
|
201ea02b05 | ||
|
|
7637823acd |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -6,3 +6,5 @@
|
||||
*.ico binary
|
||||
*.ttf binary
|
||||
*.exe binary
|
||||
# only the latest exe, in Git LFS: old versions do not bloat the history (CI commits it after each release tag)
|
||||
game_godot/TinMerezhi.exe filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
@@ -130,3 +130,25 @@ jobs:
|
||||
run: |
|
||||
if [ -z "$BUTLER_API_KEY" ] || [ -z "$ITCH_TARGET" ]; then echo "itch.io: no BUTLER_API_KEY / ITCH_TARGET, skipped"; exit 0; fi
|
||||
butler push game_godot "$ITCH_TARGET:windows" --userversion "${TAG#v}"
|
||||
|
||||
- name: Latest exe into game_godot/ on main (Git LFS, replaces the previous one)
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
GIT_LFS_SKIP_SMUDGE: "1" # do not download the previous exe on checkout
|
||||
run: |
|
||||
R="http://x:$TOKEN@gitea:3000/${{ github.repository }}.git"
|
||||
cp game_godot/TinMerezhi.exe /tmp/TinMerezhi.exe
|
||||
git config user.name "Gitea Actions"; git config user.email "actions@localhost"
|
||||
# LFS clean filter only: ci/lfs_upload.py uploads the exe over the internal address, push skips the git-lfs hook
|
||||
git lfs install --local --skip-repo
|
||||
git fetch -q "$R" main && git checkout -qf -B main FETCH_HEAD
|
||||
cp /tmp/TinMerezhi.exe game_godot/TinMerezhi.exe
|
||||
git add game_godot/TinMerezhi.exe
|
||||
git show :game_godot/TinMerezhi.exe | head -c 200 | grep -q git-lfs || { echo "exe is not an LFS pointer, refusing to commit it into git"; exit 1; }
|
||||
if git diff --cached --quiet; then echo "exe unchanged"; exit 0; fi
|
||||
python3 ci/lfs_upload.py "$R" game_godot/TinMerezhi.exe
|
||||
git commit -qm "game_godot: TinMerezhi.exe $TAG [skip ci]"
|
||||
git push -q --no-verify "$R" HEAD:main
|
||||
echo "main: game_godot/TinMerezhi.exe = $TAG"
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,7 +1,6 @@
|
||||
# Godot cache and builds
|
||||
.godot/
|
||||
*.tmp
|
||||
game_godot/*.exe
|
||||
source_godot/tools/template.exe
|
||||
source_godot/tools/icon.ico
|
||||
# old exe parts and update folders
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Built on the server by ci/build_image.sh (workflow ci-image.yml) as the local image tinmerezhi-ci:4.7.2.
|
||||
FROM node:20-bookworm
|
||||
ARG GODOT_VER=4.7.2
|
||||
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends python3-fonttools \
|
||||
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends python3-fonttools git-lfs \
|
||||
wine64 wine xvfb xauth libgl1-mesa-dri \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN curl -sSL --fail -o /tmp/g.zip "https://github.com/godotengine/godot/releases/download/${GODOT_VER}-stable/Godot_v${GODOT_VER}-stable_linux.x86_64.zip" \
|
||||
|
||||
31
ci/lfs_upload.py
Normal file
31
ci/lfs_upload.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Uploads one file to the Gitea LFS store over the internal address.
|
||||
git-lfs in the job cannot do it: the server answers with links to the public ROOT_URL (Funnel), unreachable from the job.
|
||||
Usage: python3 ci/lfs_upload.py http://x:TOKEN@gitea:3000/owner/repo.git FILE"""
|
||||
import base64, hashlib, json, os, sys, urllib.parse, urllib.request
|
||||
|
||||
remote, path = sys.argv[1], sys.argv[2]
|
||||
u = urllib.parse.urlsplit(remote)
|
||||
base = f"{u.scheme}://{u.hostname}" + (f":{u.port}" if u.port else "")
|
||||
auth = "Basic " + base64.b64encode(f"{u.username}:{u.password}".encode()).decode()
|
||||
data = open(path, "rb").read()
|
||||
oid, size = hashlib.sha256(data).hexdigest(), len(data)
|
||||
T = "application/vnd.git-lfs+json"
|
||||
|
||||
def call(url, body, headers, method="POST", ctype=T):
|
||||
# keep only the path of the server's link and send it to the internal address
|
||||
p = urllib.parse.urlsplit(url)
|
||||
req = urllib.request.Request(base + p.path + (f"?{p.query}" if p.query else ""), data=body, method=method,
|
||||
headers={**headers, "Content-Type": ctype, "Accept": T})
|
||||
with urllib.request.urlopen(req) as r:
|
||||
return r.read()
|
||||
|
||||
batch = json.dumps({"operation": "upload", "transfers": ["basic"], "objects": [{"oid": oid, "size": size}]}).encode()
|
||||
obj = json.loads(call(f"{base}{u.path}/info/lfs/objects/batch", batch, {"Authorization": auth}))["objects"][0]
|
||||
if "error" in obj:
|
||||
sys.exit(f"LFS batch error: {obj['error']}")
|
||||
act = obj.get("actions") or {}
|
||||
if "upload" in act:
|
||||
call(act["upload"]["href"], data, act["upload"].get("header", {}), "PUT", "application/octet-stream")
|
||||
if "verify" in act:
|
||||
call(act["verify"]["href"], json.dumps({"oid": oid, "size": size}).encode(), act["verify"].get("header", {}))
|
||||
print(f"LFS {oid[:12]} ({size} bytes): {'uploaded' if 'upload' in act else 'already on the server'}")
|
||||
@@ -5,7 +5,8 @@
|
||||
ЩОБ ПРОСТО ГРАТИ
|
||||
----------------
|
||||
game_godot\TinMerezhi.exe — гра (рушій Godot), Windows 10/11 64-біт.
|
||||
Якщо exe тут немає (копія з git), завантаж його з https://tuberon.itch.io/tinmerezhi
|
||||
У git exe лежить через Git LFS (лише остання версія). Якщо після git clone файл
|
||||
важить ~130 байт, виконай один раз: git lfs install && git lfs pull. Або завантаж exe з https://tuberon.itch.io/tinmerezhi
|
||||
або з Releases: https://serv.tail9357bc.ts.net/junior/TinMerezhi/releases/latest
|
||||
|
||||
Інструкція й усі команди — у game_godot\ПРОЧИТАЙ.txt.
|
||||
|
||||
Reference in New Issue
Block a user