Files
email-notification/.gitea/workflows/ci.yaml
teddys48 3cde6f7810
All checks were successful
Build and Deploy / cleaning (push) Successful in 6s
Build and Deploy / build_image (push) Successful in 2m53s
Build and Deploy / deploy (push) Successful in 1s
update
2026-02-11 12:12:20 +07:00

57 lines
1.2 KiB
YAML

name: Build and Deploy
on:
push:
branches:
- main
env:
REGISTRY: localhost:9999
IMAGE_NAME: ${{ secrets.PROJECT_NAME }}
jobs:
cleaning:
runs-on: host
container: null
steps:
- name: Cleanup
run: |
docker stop $IMAGE_NAME || true
docker rm $IMAGE_NAME || true
docker container prune -f
docker image prune -af
build_image:
runs-on: host
needs: cleaning
steps:
- name: Clone repo
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
git checkout ${{ gitea.ref_name }}
- name: Copy env
run: |
echo "${{ secrets.ENV_FILE }}" > .env
cat .env
- name: Build & Push
run: |
docker build -t $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }} .
docker push $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }}
deploy:
runs-on: host
container: null
needs: build_image
steps:
- name: Deploy container
run: |
docker run -d \
--name $IMAGE_NAME \
--memory="50m" \
--cpus="0.1" \
--restart always \
-p 9997:3000 \
$REGISTRY/$IMAGE_NAME:${{ gitea.run_number }}