80 lines
2.4 KiB
YAML
80 lines
2.4 KiB
YAML
workspace:
|
|
base: /woodpecker
|
|
path: src
|
|
|
|
when:
|
|
- event: cron
|
|
branch: main
|
|
- event: pull_request
|
|
- event: push
|
|
branch: main
|
|
|
|
steps:
|
|
- name: lint
|
|
image: node:22
|
|
when:
|
|
event:
|
|
- pull_request
|
|
- push
|
|
commands:
|
|
- npm ci
|
|
- npm run lint
|
|
|
|
- name: generate-dungeon
|
|
image: ghcr.io/puppeteer/puppeteer:latest
|
|
when:
|
|
event:
|
|
- cron
|
|
environment:
|
|
OLLAMA_API_URL:
|
|
from_secret: OLLAMA_API_URL
|
|
OLLAMA_API_KEY:
|
|
from_secret: OLLAMA_API_KEY
|
|
OLLAMA_MODEL: gemma3:4b
|
|
COMFYUI_URL:
|
|
from_secret: COMFYUI_URL
|
|
commands:
|
|
- npm ci
|
|
- npm start
|
|
|
|
- name: upload-to-gitea-release
|
|
image: curlimages/curl:latest
|
|
when:
|
|
event:
|
|
- cron
|
|
environment:
|
|
GITEA_TOKEN:
|
|
from_secret: GITEA_TOKEN
|
|
commands:
|
|
- pdf=$(ls *.pdf | head -n1)
|
|
- tag=$(date +%F)
|
|
- |
|
|
echo "Creating release for tag $tag..."
|
|
create_resp=$(curl -s -w "%{http_code}" -o /tmp/create.json -X POST \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$tag\",\"name\":\"$tag\"}" \
|
|
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases)
|
|
echo "Create release HTTP status: $create_resp"
|
|
echo "Fetching release ID..."
|
|
release_id=$(curl -s \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases/tags/$tag |
|
|
awk -F: '/"id"[ ]*:/ {gsub(/[^0-9]/,"",$2); print $2; exit}')
|
|
echo "Release ID = $release_id"
|
|
echo "Checking if asset $pdf already exists..."
|
|
assets=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
|
|
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases/$release_id/assets)
|
|
echo "Assets response: $assets"
|
|
if echo "$assets" | grep -q "\"name\":\"$pdf\""; then
|
|
echo "Asset $pdf already uploaded, skipping."
|
|
exit 0
|
|
fi
|
|
echo "Uploading $pdf to release $release_id..."
|
|
upload_resp=$(curl -s -w "%{http_code}" -o /tmp/upload.json -X POST \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-F "attachment=@$pdf" \
|
|
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases/$release_id/assets)
|
|
echo "Upload HTTP status: $upload_resp"
|
|
echo "Upload response: $(cat /tmp/upload.json)"
|