From 35b318a63ede5bb4d268364b3a84801ccc2f314a Mon Sep 17 00:00:00 2001 From: ember Date: Tue, 17 Mar 2026 09:10:22 +0000 Subject: [PATCH] Add .forgejo/workflows/watch-repos.yaml --- .forgejo/workflows/watch-repos.yaml | 68 +++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .forgejo/workflows/watch-repos.yaml diff --git a/.forgejo/workflows/watch-repos.yaml b/.forgejo/workflows/watch-repos.yaml new file mode 100644 index 0000000..1bfe6dc --- /dev/null +++ b/.forgejo/workflows/watch-repos.yaml @@ -0,0 +1,68 @@ +name: Watch Repos for Changes + +on: + schedule: + - cron: '*/5 * * * *' + workflow_dispatch: + +jobs: + check-continuwuity: + runs-on: ubuntu-latest + container: + image: docker:cli + steps: + - name: Install tools + run: apk add --no-cache git curl + + - name: Check for new commits + run: | + LAST_SHA=$(curl -s "http://forgejo.tooling.svc.cluster.local:3000/api/v1/repos/ember/continuwuity/branches/deployment" | grep -o '"sha":"[^"]*"' | head -1 | cut -d'"' -f4) + BUILT_SHA=$(curl -s "http://10.70.69.22:30500/v2/ember/continuwuity/tags/list" | grep -o "$LAST_SHA" || true) + if [ -z "$BUILT_SHA" ] && [ -n "$LAST_SHA" ]; then + echo "New commit detected: $LAST_SHA" + echo "BUILD=true" >> $GITHUB_ENV + echo "SHA=$LAST_SHA" >> $GITHUB_ENV + else + echo "No new commits" + fi + + - name: Trigger build + if: env.BUILD == 'true' + run: | + git clone --depth 1 --branch deployment \ + http://forgejo.tooling.svc.cluster.local:3000/ember/continuwuity.git . + docker build -t 10.70.69.22:30500/ember/continuwuity:latest \ + -t 10.70.69.22:30500/ember/continuwuity:${SHA} \ + -f docker/Dockerfile . + docker push 10.70.69.22:30500/ember/continuwuity:latest + docker push 10.70.69.22:30500/ember/continuwuity:${SHA} + + check-fluffychat: + runs-on: ubuntu-latest + container: + image: docker:cli + steps: + - name: Install tools + run: apk add --no-cache git curl + + - name: Check for new commits + run: | + LAST_SHA=$(curl -s "http://forgejo.tooling.svc.cluster.local:3000/api/v1/repos/ember/fluffychat/branches/main" | grep -o '"sha":"[^"]*"' | head -1 | cut -d'"' -f4) + BUILT_SHA=$(curl -s "http://10.70.69.22:30500/v2/ember/fluffychat/tags/list" | grep -o "$LAST_SHA" || true) + if [ -z "$BUILT_SHA" ] && [ -n "$LAST_SHA" ]; then + echo "New commit detected: $LAST_SHA" + echo "BUILD=true" >> $GITHUB_ENV + echo "SHA=$LAST_SHA" >> $GITHUB_ENV + else + echo "No new commits" + fi + + - name: Trigger build + if: env.BUILD == 'true' + run: | + git clone --depth 1 --branch main \ + http://forgejo.tooling.svc.cluster.local:3000/ember/fluffychat.git . + docker build -t 10.70.69.22:30500/ember/fluffychat:latest \ + -t 10.70.69.22:30500/ember/fluffychat:${SHA} . + docker push 10.70.69.22:30500/ember/fluffychat:latest + docker push 10.70.69.22:30500/ember/fluffychat:${SHA}