Compare commits

..

3 Commits

Author SHA1 Message Date
d943b6deaa branch into version
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2026-01-29 20:08:14 +01:00
b3b2159d75 add name to header
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2026-01-27 22:12:11 +01:00
ae56cf3555 pipeline update
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2026-01-26 22:16:02 +01:00
3 changed files with 81 additions and 27 deletions

View File

@@ -1,21 +1,20 @@
environment: &environment
GAME_NAME: impostor
GAME_LANG: lua
steps: steps:
- name: version
image: alpine
commands:
- 'apk add --no-cache make'
- 'make ci-version'
- name: build - name: build
image: git.teletype.hu/internal/tic80pro:latest image: git.teletype.hu/internal/tic80pro:latest
environment: environment:
<<: *environment
XDG_RUNTIME_DIR: /tmp XDG_RUNTIME_DIR: /tmp
commands: commands:
- make build - 'make ci-export'
- make export
- name: artifact - name: artifact
image: alpine image: alpine
environment: environment:
<<: *environment
DROPAREA_HOST: vps.teletype.hu DROPAREA_HOST: vps.teletype.hu
DROPAREA_PORT: 2223 DROPAREA_PORT: 2223
DROPAREA_TARGET_PATH: /home/drop DROPAREA_TARGET_PATH: /home/drop
@@ -23,17 +22,15 @@ steps:
DROPAREA_SSH_PASSWORD: DROPAREA_SSH_PASSWORD:
from_secret: droparea_ssh_password from_secret: droparea_ssh_password
commands: commands:
- apk add --no-cache openssh-client sshpass - 'apk add --no-cache make openssh-client sshpass'
- mkdir -p /root/.ssh - 'make ci-upload'
- sshpass -p $DROPAREA_SSH_PASSWORD scp -o StrictHostKeyChecking=no -P $DROPAREA_PORT $GAME_NAME.$GAME_LANG $GAME_NAME.tic $GAME_NAME.html.zip $DROPAREA_USER@$DROPAREA_HOST:$DROPAREA_TARGET_PATH/$GAME_NAME/
- name: update - name: update
image: alpine image: alpine
environment: environment:
<<: *environment
UPDATE_SERVER: https://games.vps.teletype.hu UPDATE_SERVER: https://games.vps.teletype.hu
UPDATE_SECRET: UPDATE_SECRET:
from_secret: update_secret_key from_secret: update_secret_key
commands: commands:
- apk add --no-cache curl - 'apk add --no-cache make curl'
- curl "$UPDATE_SERVER/update?secret=$UPDATE_SECRET&name=$GAME_NAME&platform=tic80" - 'make ci-update'

View File

@@ -14,6 +14,15 @@ SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER))
ASSETS_LUA = inc/meta/meta.assets.lua ASSETS_LUA = inc/meta/meta.assets.lua
# CI/CD variables
VERSION_FILE = .version
GAME_LANG ?= lua
DROPAREA_HOST ?= vps.teletype.hu
DROPAREA_PORT ?= 2223
DROPAREA_TARGET_PATH ?= /home/drop
DROPAREA_USER ?= drop
UPDATE_SERVER ?= https://games.vps.teletype.hu
all: build all: build
build: $(OUTPUT) build: $(OUTPUT)
@@ -25,6 +34,28 @@ $(OUTPUT): $(SRC) $(ORDER)
echo "" >> $(OUTPUT); \ echo "" >> $(OUTPUT); \
done < $(ORDER) done < $(ORDER)
export: build
@if [ -z "$(VERSION)" ]; then \
echo "ERROR: VERSION not set!"; \
exit 1; \
fi
@echo "==> Exporting HTML for version $(VERSION)"
@tic80 --cli --skip --fs=. \
--cmd="load $(OUTPUT) & save $(PROJECT)-$(VERSION) & export html $(PROJECT)-$(VERSION).html & exit"
@echo "==> Creating versioned files"
@if [ -f "$(PROJECT)-$(VERSION).tic" ]; then \
cp $(PROJECT)-$(VERSION).tic $(PROJECT).tic; \
fi
@if [ -f "$(PROJECT)-$(VERSION).html.zip" ]; then \
cp $(PROJECT)-$(VERSION).html.zip $(PROJECT).html.zip; \
fi
@echo "==> Generated files:"
@ls -lh $(PROJECT)-$(VERSION).* $(PROJECT).tic $(PROJECT).html.zip 2>/dev/null || true
watch:
make build
fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done
import_assets: import_assets:
@for t in $(ASSET_TYPES); do \ @for t in $(ASSET_TYPES); do \
for f in $(ASSETS_DIR)/$$t/*.png; do \ for f in $(ASSETS_DIR)/$$t/*.png; do \
@@ -45,15 +76,40 @@ export_assets: build
/^-- <MUSIC>/,/^-- <\/MUSIC>/p' \ /^-- <MUSIC>/,/^-- <\/MUSIC>/p' \
$(OUTPUT) > $(ASSETS_LUA) $(OUTPUT) > $(ASSETS_LUA)
export: build clean:
@{ \ @rm -f $(PROJECT)-*.tic $(PROJECT)-*.html.zip $(OUTPUT)
VERSION=$$(sed -n 's/^-- version: //p' $(OUTPUT) | head -n 1); \ @echo "==> Cleaned build artifacts"
echo "==> Exporting HTML for version $$VERSION"; \
mkdir -p "$$VERSION"; \ # CI/CD Targets
tic80 --cli --skip --fs=. \ ci-version:
--cmd="load $(OUTPUT) & save $(PROJECT) & export html $$VERSION/$(PROJECT).html & exit"; \ @VERSION=$$(sed -n "s/^-- version: //p" inc/meta/meta.header.lua | head -n 1 | tr -d "[:space:]"); \
} BRANCH=$${CI_COMMIT_BRANCH:-$${WOODPECKER_BRANCH}}; \
if [ "$$BRANCH" != "main" ] && [ "$$BRANCH" != "master" ] && [ -n "$$BRANCH" ]; then \
VERSION=dev-$$VERSION-$$BRANCH; \
fi; \
echo "VERSION is: $$VERSION"; \
echo $$VERSION > $(VERSION_FILE)
ci-export:
@VERSION=$$(cat $(VERSION_FILE)); \
echo "==> Building and exporting version $$VERSION"; \
$(MAKE) export VERSION=$$VERSION
ci-upload:
@VERSION=$$(cat $(VERSION_FILE)); \
echo "==> Uploading artifacts for version $$VERSION"; \
ls -lh $(PROJECT)-$$VERSION.* $(PROJECT).tic $(PROJECT).html.zip 2>/dev/null || true; \
cp $(PROJECT).lua $(PROJECT)-$$VERSION.lua; \
FILE_LUA=$(PROJECT)-$$VERSION.lua; \
FILE_TIC=$(PROJECT)-$$VERSION.tic; \
FILE_HTML_ZIP=$(PROJECT)-$$VERSION.html.zip; \
SCP_TARGET="$(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/"; \
sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) $$FILE_LUA $$FILE_TIC $$FILE_HTML_ZIP $$SCP_TARGET
ci-update:
@VERSION=$$(cat $(VERSION_FILE)); \
echo "==> Triggering update for version $$VERSION"; \
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=tic80&version=$$VERSION"
.PHONY: all build export watch import_assets export_assets clean ci-version ci-export ci-upload ci-update
watch:
make build
fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done

View File

@@ -1,4 +1,5 @@
-- title: Definitely not an Impostor -- title: Definitely not an Impostor
-- name: impostor
-- author: Teletype Games -- author: Teletype Games
-- desc: Life of a programmer in the Vector -- desc: Life of a programmer in the Vector
-- site: https://git.teletype.hu/games/impostor -- site: https://git.teletype.hu/games/impostor