Add GitHub staging deployment workflow

This commit is contained in:
2026-06-02 20:45:05 -07:00
parent 87ebfa1fac
commit 3df59ef345
3 changed files with 199 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
# GitHub Staging Deploy
This repository deploys the `internal` branch to the staging server `154.12.35.103` with GitHub Actions.
## Required GitHub secrets
- `STAGING_SSH_USER`: SSH user for `154.12.35.103`.
- `STAGING_SSH_KEY`: Private SSH key that can log in to the staging server.
- `STAGING_SSH_PORT`: SSH port. Use `22` if the server uses the default port.
- `GHCR_USERNAME`: Optional. Required only if the GHCR package is private and the server needs to log in before pulling.
- `GHCR_TOKEN`: Optional. A GitHub PAT with `read:packages` for private GHCR pulls.
## Server requirements
- Docker and either `docker compose` or `docker-compose` are installed.
- The deployment directory is `/opt/hifast-server`.
- Runtime files already exist beside `docker-compose.cloud.yml`, especially `configs/ppanel.yaml`, `logs/`, `cache/`, `loki/`, `grafana/`, `prometheus/`, and `tempo/`.
## What the workflow does
1. Builds the Docker image for `linux/amd64`.
2. Pushes `ghcr.io/tawcorp/hifast-server:<commit-sha>` and `ghcr.io/tawcorp/hifast-server:staging`.
3. Copies `docker-compose.cloud.yml` to the staging server.
4. Pulls the immutable commit image and restarts `ppanel-server`.
5. Checks `http://127.0.0.1:8080/v1/common/heartbeat`.
6. Attempts rollback to the previous container image if the health check fails.