add gitea deploy script
Some checks failed
Garfbot CI/CD Deployment / Deploy (push) Failing after 1s
Some checks failed
Garfbot CI/CD Deployment / Deploy (push) Failing after 1s
This commit is contained in:
32
.gitea/workflows/deploy.yaml
Normal file
32
.gitea/workflows/deploy.yaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
name: Garfbot CI/CD Deployment
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: docker:latest
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- /home/crate/garfbot:/workspace
|
||||||
|
steps:
|
||||||
|
- name: Pull Garfbot and restart container
|
||||||
|
run: |
|
||||||
|
apk add --no-cache git
|
||||||
|
cd /workspace
|
||||||
|
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
|
CHANGED=$(git diff --name-only HEAD~1 HEAD)
|
||||||
|
|
||||||
|
if echo "$CHANGED" | grep -qE "(Dockerfile|requirements\.txt|docker-compose\.yml)"; then
|
||||||
|
docker stop garfbot
|
||||||
|
docker rm garfbot
|
||||||
|
docker build -t git.crate.zip/crate/garfbot:latest .
|
||||||
|
docker run -d --restart always -v $PWD:/usr/src/app --name garfbot git.crate.zip/crate/garfbot:latest
|
||||||
|
else
|
||||||
|
docker restart garfbot
|
||||||
|
fi
|
Reference in New Issue
Block a user