From 5d856f1062ec77ab580a35f2453bdda5f8a71f29 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Fri, 31 Jul 2026 16:48:13 +0200 Subject: [PATCH] pipeline --- .gitignore | 8 ++- .woodpecker.yaml | 35 ++++++++++++ Makefile | 74 ++++++++++++++++++++++++++ README.md | 45 ++++++++++++++++ export_presets.cfg | 43 +++++++++++++++ metadata.json | 9 ++++ scenes/boot_splash/BootSplash.gd.uid | 1 + scenes/main_menu/ExitButton.gd.uid | 1 + scenes/main_menu/NewGameButton.gd.uid | 1 + scenes/playground/Playground.gd.uid | 1 + scenes/playground/ball/Ball.gd.uid | 1 + scenes/playground/racket/Racket.gd.uid | 1 + 12 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 .woodpecker.yaml create mode 100644 Makefile create mode 100644 README.md create mode 100644 export_presets.cfg create mode 100644 metadata.json create mode 100644 scenes/boot_splash/BootSplash.gd.uid create mode 100644 scenes/main_menu/ExitButton.gd.uid create mode 100644 scenes/main_menu/NewGameButton.gd.uid create mode 100644 scenes/playground/Playground.gd.uid create mode 100644 scenes/playground/ball/Ball.gd.uid create mode 100644 scenes/playground/racket/Racket.gd.uid diff --git a/.gitignore b/.gitignore index f17ee95..7730e74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ # Godot 4+ specific ignores .godot/ -.vscode \ No newline at end of file +.vscode + +# Build artifacts +dist/ +*.zip +.version +.DS_Store diff --git a/.woodpecker.yaml b/.woodpecker.yaml new file mode 100644 index 0000000..8685347 --- /dev/null +++ b/.woodpecker.yaml @@ -0,0 +1,35 @@ +steps: + - name: version + image: alpine + commands: + - apk add --no-cache git make jq + - make ci-version + + - name: build + image: barichello/godot-ci:4.7.1 + commands: + - apt-get update && apt-get install -y --no-install-recommends make zip + - make ci-export + + - name: artifact + image: alpine + environment: + DROPAREA_HOST: vps.teletype.hu + DROPAREA_PORT: 2223 + DROPAREA_TARGET_PATH: /home/drop + DROPAREA_USER: drop + DROPAREA_SSH_PASSWORD: + from_secret: droparea_ssh_password + commands: + - apk add --no-cache make openssh-client sshpass + - make ci-upload + + - name: update + image: alpine + environment: + UPDATE_SERVER: https://teletypegames.org + UPDATE_SECRET: + from_secret: update_secret_key + commands: + - apk add --no-cache make curl + - make ci-update diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cc6231f --- /dev/null +++ b/Makefile @@ -0,0 +1,74 @@ +# ----------------------------------------- +# Makefile – Godot project builder +# ----------------------------------------- + +PROJECT = pong + +GODOT ?= godot +EXPORT_PRESET = Web + +DIST_DIR = dist +WEB_DIR = $(DIST_DIR)/web +OUTPUT_ZIP = $(PROJECT)-$(VERSION).html.zip + +VERSION_FILE = .version + +all: build + +build: + $(GODOT) --headless --import + +run: + $(GODOT) --path . + +web: build + @mkdir -p $(WEB_DIR) + @echo "==> Exporting web build ($(EXPORT_PRESET) preset)" + $(GODOT) --headless --export-release "$(EXPORT_PRESET)" $(WEB_DIR)/index.html + +export: web + @if [ -z "$(VERSION)" ]; then \ + echo "ERROR: VERSION not set!"; exit 1; \ + fi + @echo "==> Packaging web build for $(VERSION)" + cd $(WEB_DIR) && zip -r ../../$(OUTPUT_ZIP) . + @echo "==> Cleaning temporary files" + rm -rf $(WEB_DIR) + +watch: + fswatch -o . --include="\.gd$$" --include="\.tscn$$" | while read; do make build; done + +clean: + rm -rf $(DIST_DIR) .godot + +ci-version: + @if [ -f metadata.json ]; then \ + VERSION=$$(jq -r '.version' metadata.json); \ + else \ + VERSION=$$(git rev-parse --short HEAD); \ + fi; \ + BRANCH=$$(git rev-parse --abbrev-ref HEAD); \ + if [ "$$BRANCH" != "main" ] && [ "$$BRANCH" != "master" ]; then \ + VERSION="dev-$$VERSION-$$BRANCH"; \ + fi; \ + echo $$VERSION > $(VERSION_FILE) + +ci-export: + @VERSION=$$(cat $(VERSION_FILE)); \ + $(MAKE) export VERSION=$$VERSION + +ci-upload: + @VERSION=$$(cat $(VERSION_FILE)); \ + FILE="$(PROJECT)-$$VERSION.html.zip"; \ + META_SRC="metadata.json"; \ + META_DST="$(PROJECT)-$$VERSION.metadata.json"; \ + cp $$META_SRC $$META_DST; \ + sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) \ + $$FILE $$META_DST \ + $(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/ + +ci-update: + @VERSION=$$(cat $(VERSION_FILE)); \ + curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=godot&version=$$VERSION" + +.PHONY: all build run web export watch clean ci-version ci-export ci-upload ci-update diff --git a/README.md b/README.md new file mode 100644 index 0000000..c23809f --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# Pong + +The classic two-player Pong, made in [Godot](https://godotengine.org) +(4.x). First player to out-rally the other — every missed ball is a +point for the opponent. + +## Controls + +| Action | Left player | Right player | +|--------|-------------|--------------| +| Paddle up | `Q` | `O` | +| Paddle down | `A` | `L` | + +`Space` confirms in the menu, `Esc` quits the game. + +## Development + +The project uses the [godot-tools](https://git.teletype.hu/tools/godot-tools) +templates: build logic lives in the `Makefile`, the web export +configuration in `export_presets.cfg` (the `Web` preset, threads +disabled). + +```sh +make run # run the game locally +make build # headless import (.godot cache, project check) +make web # export web build to dist/web/ +make export VERSION=x # package dist/web/ into pong-x.html.zip +make clean # remove dist/ and the import cache +``` + +Requirements: `godot` (4.x editor binary) on PATH with the matching web +export templates installed, plus `make` and `zip`. `.vscode/tasks.json` +(copied from godot-tools, not tracked) provides the same targets as +VS Code tasks. + +## CI/CD + +Woodpecker builds every push (`.woodpecker.yaml`): version → headless +web export (`barichello/godot-ci` image) → upload to the droparea → +`/update?platform=godot` on teletypegames.org. The version comes from +`metadata.json` (non-main branches get a `dev-` prefix). Keep the +`barichello/godot-ci` image tag in sync with the Godot version the +project is edited with. + +Detailed documentation lives on the wiki: `/development/godot`. diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..fa0c4f6 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,43 @@ +; Copy to export_presets.cfg in the project root (or merge the preset +; into your existing file). The "Web" preset name is what the Makefile +; passes to `godot --headless --export-release`. +; +; `variant/thread_support=false` keeps the build runnable without +; COOP/COEP (cross-origin isolation) headers, which the game hosting +; does not send. Requires Godot 4.3+. + +[preset.0] + +name="Web" +platform="Web" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="dist/web/index.html" +patches=PackedStringArray() +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +variant/extensions_support=false +variant/thread_support=false +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=false +html/export_icon=true +html/custom_html_shell="" +html/head_include="" +html/canvas_resize_policy=2 +html/focus_canvas_on_start=true +html/experimental_virtual_keyboard=false +progressive_web_app/enabled=false diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..e58e075 --- /dev/null +++ b/metadata.json @@ -0,0 +1,9 @@ +{ + "name": "pong", + "title": "Pong", + "author": "Teletype Games", + "desc": "The classic two-player Pong, made in Godot.", + "site": "https://git.teletype.hu/games/pong", + "license": "MIT License", + "version": "0.1.0" +} diff --git a/scenes/boot_splash/BootSplash.gd.uid b/scenes/boot_splash/BootSplash.gd.uid new file mode 100644 index 0000000..33e2e16 --- /dev/null +++ b/scenes/boot_splash/BootSplash.gd.uid @@ -0,0 +1 @@ +uid://bs08mkounx56i diff --git a/scenes/main_menu/ExitButton.gd.uid b/scenes/main_menu/ExitButton.gd.uid new file mode 100644 index 0000000..d632a45 --- /dev/null +++ b/scenes/main_menu/ExitButton.gd.uid @@ -0,0 +1 @@ +uid://cdgeben1xfrxd diff --git a/scenes/main_menu/NewGameButton.gd.uid b/scenes/main_menu/NewGameButton.gd.uid new file mode 100644 index 0000000..48d145c --- /dev/null +++ b/scenes/main_menu/NewGameButton.gd.uid @@ -0,0 +1 @@ +uid://c6vhexjie6miy diff --git a/scenes/playground/Playground.gd.uid b/scenes/playground/Playground.gd.uid new file mode 100644 index 0000000..e8cc9d1 --- /dev/null +++ b/scenes/playground/Playground.gd.uid @@ -0,0 +1 @@ +uid://b38jok4r2frgs diff --git a/scenes/playground/ball/Ball.gd.uid b/scenes/playground/ball/Ball.gd.uid new file mode 100644 index 0000000..350da76 --- /dev/null +++ b/scenes/playground/ball/Ball.gd.uid @@ -0,0 +1 @@ +uid://c3n4g8iah6el5 diff --git a/scenes/playground/racket/Racket.gd.uid b/scenes/playground/racket/Racket.gd.uid new file mode 100644 index 0000000..fef76d0 --- /dev/null +++ b/scenes/playground/racket/Racket.gd.uid @@ -0,0 +1 @@ +uid://gugjkqst8i8b