All checks were successful
Deploy to Private Server / deploy (push) Successful in 8s
46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
name: Deploy to Private Server
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: homesrv
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t timelapse-calc:latest \
|
|
-f Dockerfile .
|
|
|
|
- name: Stop old container if exists
|
|
run: |
|
|
if docker ps -a --format '{{.Names}}' | grep -q '^timelapse-calc$'; then
|
|
docker stop timelapse-calc
|
|
docker rm timelapse-calc
|
|
fi
|
|
|
|
- name: Run new container
|
|
run: |
|
|
docker run -d \
|
|
--restart always \
|
|
--name timelapse-calc \
|
|
-p 3005:80 \
|
|
timelapse-calc:latest
|
|
|
|
docker ps --format "{{.Names}} {{.Image}} {{.Status}}"
|
|
|
|
- name: Send Deployment Notification
|
|
uses: https://git.hcmc.online/actions/deploy-notify@main
|
|
if: always()
|
|
with:
|
|
status: ${{ job.status }}
|
|
title: "Deploy: ${{ github.repository }}"
|
|
message: |
|
|
Ref: ${{ github.ref_name }}
|
|
Commit: ${{ github.sha }}
|
|
Status: ${{ job.status }}
|
|
Actor: ${{ github.actor }} |