Deploy to VPS / deploy (push) Failing after 1m47s
Frontend not in pnpm workspace (uses bun.lock locally), so build it directly with pnpm install + build in its own directory.
86 lines
2.1 KiB
YAML
86 lines
2.1 KiB
YAML
name: Deploy to VPS
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
ca-certificates \
|
|
curl \
|
|
libssl-dev \
|
|
pkg-config \
|
|
python3
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 11.1.3
|
|
run_install: false
|
|
|
|
- name: Set up Rust (for node-crc native build)
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Lint
|
|
run: pnpm run lint
|
|
|
|
- name: Build shared package
|
|
run: pnpm --filter './packages/shared' run build
|
|
|
|
- name: Build backend
|
|
run: pnpm run build:backend
|
|
|
|
- name: Build discord gateway
|
|
run: pnpm run build:discord-gateway
|
|
|
|
- name: Build frontend
|
|
run: |
|
|
pnpm install --no-frozen-lockfile
|
|
pnpm run build
|
|
working-directory: services/frontend
|
|
|
|
- name: Prepare production environment file
|
|
env:
|
|
PRODUCTION_ENV: ${{ secrets.PRODUCTION_ENV }}
|
|
run: |
|
|
umask 077
|
|
printf '%s\n' "$PRODUCTION_ENV" | tr -d '\r' > .env
|
|
chmod 600 .env
|
|
|
|
- name: Prepare SSH key
|
|
env:
|
|
VPS_SSH_KEY_CONTENT: ${{ secrets.VPS_SSH_KEY }}
|
|
run: |
|
|
umask 077
|
|
key_file="${RUNNER_TEMP:-/tmp}/bete-vps-key"
|
|
printf '%s\n' "$VPS_SSH_KEY_CONTENT" > "$key_file"
|
|
chmod 600 "$key_file"
|
|
echo "VPS_SSH_KEY=$key_file" >> "$GITHUB_ENV"
|
|
|
|
- name: Deploy
|
|
env:
|
|
VPS_HOST: ${{ secrets.VPS_HOST }}
|
|
VPS_USER: ${{ secrets.VPS_USER }}
|
|
run: ./deploy.sh --no-build
|