Init
Publish Docker image / Build and Push Docker image (push) Successful in 15s
Publish Docker image / Build and Push Docker image (release) Successful in 8s

This commit is contained in:
WilliamSoderberg committed 2026-10-13 10:51:43 +02:00 Verified
commit 339e0d0e1b
3 files changed
+101

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
name: Publish Docker image
on:
release:
types: [published]
push:
tags:
- "v*"
jobs:
push_to_registry:
name: Build and Push Docker image
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: git.stws.cc
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: git.stws.cc/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Build and push Docker images
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+8
View File
@@ -0,0 +1,8 @@
FROM alpine:latest
RUN apk add --no-cache curl jq unzip
COPY sync-theme.sh /usr/local/bin/sync-theme.sh
RUN chmod +x /usr/local/bin/sync-theme.sh
ENTRYPOINT ["/usr/local/bin/sync-theme.sh"]
+49
View File
@@ -0,0 +1,49 @@
#!/bin/sh
set -e
TARGET_DIR="/data/gitea"
CHECK_INTERVAL=${CHECK_INTERVAL:-86400} # Default: re-check every 24 hours
sync_theme() {
echo "[Theme Syncer] Checking for latest theme release..."
RELEASE_JSON=$(curl -s https://api.github.com/repos/lutinglt/gitea-github-theme/releases/latest)
TAG_NAME=$(echo "$RELEASE_JSON" | jq -r '.tag_name // empty')
if [ -z "$TAG_NAME" ] || [ "$TAG_NAME" = "null" ]; then
echo "[Theme Syncer] Could not reach GitHub API or parse release. Will retry later."
return 0
fi
echo "[Theme Syncer] Processing theme release: $TAG_NAME"
CSS_URLS=$(echo "$RELEASE_JSON" | jq -r '.assets[] | select(.name | endswith(".css")) | .browser_download_url')
TMPL_URL=$(echo "$RELEASE_JSON" | jq -r '.assets[] | select(.name | test("template.*\\.zip")) | .browser_download_url' | head -n 1)
mkdir -p "$TARGET_DIR/public/assets/css" "$TARGET_DIR/templates"
for url in $CSS_URLS; do
fname=$(basename "$url")
echo "[Theme Syncer] Syncing CSS: $fname"
curl -sL "$url" -o "$TARGET_DIR/public/assets/css/$fname"
done
if [ -n "$TMPL_URL" ] && [ "$TMPL_URL" != "null" ]; then
echo "[Theme Syncer] Syncing templates..."
curl -sL "$TMPL_URL" -o /tmp/templates.zip
unzip -qo /tmp/templates.zip -d "$TARGET_DIR/templates/"
rm -f /tmp/templates.zip
fi
if [ -n "$USER_UID" ] && [ -n "$USER_GID" ]; then
chown -R "$USER_UID:$USER_GID" "$TARGET_DIR/public" "$TARGET_DIR/templates"
fi
echo "[Theme Syncer] Sync complete for $TAG_NAME."
}
sync_theme
while true; do
sleep "$CHECK_INTERVAL"
sync_theme
done