Compare commits

..

5 Commits

Author SHA1 Message Date
3dc28849c4 #24 Assets Import-export fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2026-01-29 23:21:00 +01:00
8a6214e893 restore asset constants
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2026-01-29 21:49:18 +01:00
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 117 additions and 43 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'

134
Makefile
View File

@@ -13,47 +13,123 @@ SRC_DIR = inc
SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER)) SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER))
ASSETS_LUA = inc/meta/meta.assets.lua ASSETS_LUA = inc/meta/meta.assets.lua
ASSETS_DIR = assets
ASSET_TYPES = tiles sprites sfx music
# 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)
$(OUTPUT): $(SRC) $(ORDER) $(OUTPUT): $(SRC) $(ORDER)
@rm -f $(OUTPUT) @rm -f $(OUTPUT)
@while read f; do \ @while read f; do \
cat "$(SRC_DIR)/$$f" >> $(OUTPUT); \ cat "$(SRC_DIR)/$$f" >> $(OUTPUT); \
echo "" >> $(OUTPUT); \ echo "" >> $(OUTPUT); \
done < $(ORDER) done < $(ORDER)
import_assets:
@for t in $(ASSET_TYPES); do \
for f in $(ASSETS_DIR)/$$t/*.png; do \
[ -e "$$f" ] || continue; \
echo "==> Importing $$f as $$t..."; \
tic80 --cli --skip --fs=. --cmd="import $$t $$f & exit"; \
done; \
done
export_assets: build
@echo "==> Exporting TIC-80 asset sections"
@mkdir -p inc/meta
@sed -n '/^-- <PALETTE>/,/^-- <\/PALETTE>/p;\
/^-- <TILES>/,/^-- <\/TILES>/p;\
/^-- <SPRITES>/,/^-- <\/SPRITES>/p;\
/^-- <MAP>/,/^-- <\/MAP>/p;\
/^-- <SFX>/,/^-- <\/SFX>/p;\
/^-- <MUSIC>/,/^-- <\/MUSIC>/p' \
$(OUTPUT) > $(ASSETS_LUA)
export: build export: build
@{ \ @if [ -z "$(VERSION)" ]; then \
VERSION=$$(sed -n 's/^-- version: //p' $(OUTPUT) | head -n 1); \ echo "ERROR: VERSION not set!"; \
echo "==> Exporting HTML for version $$VERSION"; \ exit 1; \
mkdir -p "$$VERSION"; \ fi
tic80 --cli --skip --fs=. \ @echo "==> Exporting HTML for version $(VERSION)"
--cmd="load $(OUTPUT) & save $(PROJECT) & export html $$VERSION/$(PROJECT).html & exit"; \ @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: watch:
make build make build
fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done
import_assets: $(OUTPUT)
@TIC_CMD="load $(OUTPUT) &"; \
for t in $(ASSET_TYPES); do \
for f in $(ASSETS_DIR)/$$t/*.png; do \
[ -e "$$f" ] || continue; \
echo "==> Importing $$f as $$t..."; \
TIC_CMD="$${TIC_CMD} & import $$t $$f"; \
done; \
done; \
TIC_CMD="$$TIC_CMD save & exit"; \
echo $$TIC_CMD; \
tic80 --cli --skip --fs=. --cmd="$$TIC_CMD"
# export helper function
define f_export_asset_awk
cat $(2) | awk '/-- <$(1)>/,/<\/$(1)>/' >> $(3)
endef
export_assets:
# $(OUTPUT) would be a circular dependency
@test -e $(OUTPUT)
@echo "==> Exporting TIC-80 asset sections"
@mkdir -p inc/meta
@echo -n '' > $(ASSETS_LUA)
@$(call f_export_asset_awk,PALETTE,$(OUTPUT),$(ASSETS_LUA))
@$(call f_export_asset_awk,TILES,$(OUTPUT),$(ASSETS_LUA))
@$(call f_export_asset_awk,SPRITES,$(OUTPUT),$(ASSETS_LUA))
@$(call f_export_asset_awk,MAP,$(OUTPUT),$(ASSETS_LUA))
@$(call f_export_asset_awk,SFX,$(OUTPUT),$(ASSETS_LUA))
@$(call f_export_asset_awk,WAVES,$(OUTPUT),$(ASSETS_LUA))
clean:
@rm -f $(PROJECT)-*.tic $(PROJECT)-*.html.zip $(OUTPUT)
@echo "==> Cleaned build artifacts"
# CI/CD Targets
ci-version:
@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
#-- <WAVES>
#-- 000:224578acdeeeeddcba95434567653100
#-- </WAVES>
#
#-- <SFX>
#-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000
#-- </SFX>

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