68 lines
2.6 KiB
YAML
68 lines
2.6 KiB
YAML
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}
|