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 - 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 }}