From 1bb8108989064a0263d7e38f68ac90fa99e0115c Mon Sep 17 00:00:00 2001 From: Opnxng Date: Sun, 23 Feb 2025 11:01:16 +0800 Subject: [PATCH] Added Soundcloak --- .gitea/workflows/soundcloak.yaml | 66 ++++++++++++++++++++++++++++++++ copy/instance.css | 7 ++++ 2 files changed, 73 insertions(+) create mode 100644 .gitea/workflows/soundcloak.yaml create mode 100644 copy/instance.css diff --git a/.gitea/workflows/soundcloak.yaml b/.gitea/workflows/soundcloak.yaml new file mode 100644 index 0000000..0f4763f --- /dev/null +++ b/.gitea/workflows/soundcloak.yaml @@ -0,0 +1,66 @@ +name: soundcloak +run-name: soundcloak +env: + REPO_NAME: soundcloak + REMOTE_REPO: https://git.maid.zone/stuff/soundcloak.git + BUILD_PLATFORM: linux/arm64 +on: + schedule: + - cron: "0 0 * * *" # at midnight + push: + paths: + - ".gitea/workflows/soundcloak.yaml" + +jobs: + build-soundcloak: + runs-on: runner + container: + image: git.opnxng.com/opnxng/docker-buildx:latest + steps: + - name: Check latest upstream commit + run: | + STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1) + LATEST_COMMIT=$(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) + echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV" + echo "LATEST_COMMIT=${LATEST_COMMIT}" >> "$GITHUB_ENV" + echo "Stored Commit: ${STORED_COMMIT}" + echo "Latest Commit: ${LATEST_COMMIT}" + + - name: Build and push Docker image + run: | + if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then + echo "Found a new commit, building new image" + # Create and use Docker Buildx builder + docker buildx create --use --name buildx + # Login to Package Registry + echo "${{ secrets.TOKEN }}" | docker login git.opnxng.com -u ${{ gitea.repository_owner }} --password-stdin + # Build and push Docker image + mkdir temp + cd temp + git clone ${REMOTE_REPO} . + curl -JL https://git.opnxng.com/opnxng/docker-images/raw/branch/main/copy/instance.css -o ./static/instance/instance.css + docker buildx build \ + --platform ${BUILD_PLATFORM} \ + -t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \ + -f ./Dockerfile \ + --push . && \ + curl -H prio:low -d "Built and pushed ${REPO_NAME}" https://ntfy.opnxng.com/build || \ + { curl -H tags:warning -H prio:high -d "Built and pushed ${REPO_NAME} failed!" https://ntfy.opnxng.com/build ; exit 1; } + # Remove Docker Buildx builder + docker buildx rm buildx + else + echo "No new commit, skipped build" + fi + + - name: Update stored commit + run: | + if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then + curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}" + STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1) + echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV" + else + curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}" + STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1) + echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV" + exit 1 + fi diff --git a/copy/instance.css b/copy/instance.css new file mode 100644 index 0000000..54774dd --- /dev/null +++ b/copy/instance.css @@ -0,0 +1,7 @@ +:root { + --accent: #BC5215; + --primary: #0e0e0f; + --secondary: #1C1B1A; + --0: #0e0e0f; + --text: #d1d1cf; +}