Files
scrollsmith/.gitea/workflows/release.yml
T
keligrubb a6327fe573
PR / lint (pull_request) Successful in 14s
PR / test-coverage (pull_request) Successful in 31s
Improve LLM client immutability and CI model defaults.
Replace mutable Ollama model export with a const fallback and initializeModel return value, resolving the model from the environment after optional API discovery. Use a for-of loop over attempt indices instead of let in the retry path.

Continue PDF generation when map image generation or upscaling fails, and avoid mutating request headers in place.

Document Open WebUI-style URLs in the README, pin OLLAMA_MODEL in the Gitea release workflow, and adjust integration and unit tests for the new initialization behavior.
2026-04-14 22:42:21 -04:00

87 lines
2.9 KiB
YAML

name: Release
on:
push:
branches: [main]
schedule:
- cron: "0 0 * * *"
jobs:
generate-dungeon:
name: generate-dungeon
runs-on: ubuntu-latest
container:
image: ghcr.io/puppeteer/puppeteer:latest
env:
OLLAMA_API_URL: https://ai.keligrubb.com/api/chat/completions
OLLAMA_API_KEY: ${{ secrets.OLLAMA_API_KEY }}
OLLAMA_MODEL: qwen3.5-122b-a10b
COMFYUI_URL: http://192.168.1.124:8188
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v6
- name: Setup Node
uses: https://github.com/actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Generate dungeon PDF
run: npm start
- name: Upload PDF artifact
uses: https://github.com/actions/upload-artifact@v7
with:
name: release-pdf
path: "*.pdf"
upload-to-gitea-release:
name: upload-to-gitea-release
runs-on: ubuntu-latest
needs: generate-dungeon
env:
GITEA_TOKEN: ${{ secrets.SCROLLSMITH_GITEA_TOKEN }}
steps:
- name: Download PDF artifact
uses: https://github.com/actions/download-artifact@v8
with:
name: release-pdf
- name: Create release and upload PDF
run: |
api_base="https://git.keligrubb.com/api/v1/repos/${{ gitea.repository }}"
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\"}" \
"$api_base/releases")
echo "Create release HTTP status: $create_resp"
echo "Fetching release ID..."
release_id=$(curl -s \
-H "Authorization: token $GITEA_TOKEN" \
"$api_base/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" \
"$api_base/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" \
"$api_base/releases/$release_id/assets")
echo "Upload HTTP status: $upload_resp"
echo "Upload response: $(cat /tmp/upload.json)"