gitea composer
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
gitea-act-runner:
|
||||
image: gitea/act_runner:latest
|
||||
container_name: gitea-act-runner-dlm
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
# Update this path to your TrueNAS dataset (or local runner data path)
|
||||
- /mnt/pool/gitea-runner:/data
|
||||
# Docker socket - required for runner to create job containers
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
# Update with your Gitea instance URL (accessible from this container)
|
||||
- GITEA_INSTANCE_URL=http://10.1.10.3:30008/
|
||||
# Get this from: Repository → Settings → Actions → Runners → New Runner
|
||||
- GITEA_RUNNER_REGISTRATION_TOKEN=<your-runner-token>
|
||||
# Name your runner (can be anything)
|
||||
- GITEA_RUNNER_NAME=dlm-runner
|
||||
# Labels: format is "label:docker-image"
|
||||
# These labels will be used in your workflow's runs-on field
|
||||
- GITEA_RUNNER_LABELS=ubuntu:docker://node:20-bullseye,linux:docker://node:20-bullseye
|
||||
networks:
|
||||
# Update to match your Gitea container's network
|
||||
- gitea-network
|
||||
|
||||
networks:
|
||||
gitea-network:
|
||||
external: true # Change to false if you want to create a new network
|
||||
# name: gitea # Uncomment and set if using external network
|
||||
@@ -0,0 +1,95 @@
|
||||
name: Create Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
description: 'Release tag (e.g., v0.3.0)'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get Version
|
||||
id: get_version
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import os
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
|
||||
data = tomllib.loads(Path("blender_manifest.toml").read_text(encoding="utf-8"))
|
||||
version = data["version"]
|
||||
|
||||
# Gitea Actions uses GITHUB_OUTPUT (compatible with GitHub Actions)
|
||||
output_file = os.environ.get("GITHUB_OUTPUT", os.environ.get("GITEA_OUTPUT", "/dev/stdout"))
|
||||
with open(output_file, "a", encoding="utf-8") as fh:
|
||||
fh.write(f"version={version}\n")
|
||||
fh.write(f"zip_name=dynamiclinkmanager_{version}.zip\n")
|
||||
PY
|
||||
|
||||
- name: Create ZIP
|
||||
run: |
|
||||
ADDON_DIR=dynamiclinkmanager
|
||||
mkdir -p "$ADDON_DIR"
|
||||
|
||||
# Copy top-level files
|
||||
for file in __init__.py blender_manifest.toml; do
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$ADDON_DIR"/
|
||||
else
|
||||
echo "Skipping missing file: $file"
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy directories
|
||||
cp -r ops "$ADDON_DIR"/
|
||||
cp -r ui "$ADDON_DIR"/
|
||||
if [ -d "utils" ] && [ "$(ls -A utils)" ]; then
|
||||
cp -r utils "$ADDON_DIR"/
|
||||
fi
|
||||
|
||||
# Create the zip from the temporary directory
|
||||
zip -r "${{ steps.get_version.outputs.zip_name }}" "$ADDON_DIR"/*
|
||||
|
||||
- name: Create Release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
# Gitea Actions uses github.repository context (compatible with GitHub Actions)
|
||||
API_BASE="${GITHUB_SERVER_URL}/api/v1"
|
||||
curl -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"${{ inputs.release_tag }}\",
|
||||
\"name\": \"${{ inputs.release_tag }}\",
|
||||
\"body\": \"Release ${{ steps.get_version.outputs.version }}\",
|
||||
\"draft\": true
|
||||
}" \
|
||||
"${API_BASE}/repos/${{ github.repository }}/releases" || true
|
||||
|
||||
- name: Upload Release Asset
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
API_BASE="${GITHUB_SERVER_URL}/api/v1"
|
||||
# Get the release ID
|
||||
RELEASE_ID=$(curl -s \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"${API_BASE}/repos/${{ github.repository }}/releases/tags/${{ inputs.release_tag }}" \
|
||||
| grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
||||
|
||||
if [ -n "$RELEASE_ID" ]; then
|
||||
curl -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/zip" \
|
||||
--data-binary "@${{ steps.get_version.outputs.zip_name }}" \
|
||||
"${API_BASE}/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=${{ steps.get_version.outputs.zip_name }}"
|
||||
fi
|
||||
Reference in New Issue
Block a user