47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
name: Build & Deploy
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
types: [opened, synchronize, reopened]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
|
|
- name: Verify build (locally)
|
|
run: |
|
|
npm ci --no-audit --no-fund
|
|
npm run build
|
|
|
|
- name: Stage source for upload
|
|
run: |
|
|
mkdir .deploy-stage
|
|
tar --exclude=.git --exclude=node_modules --exclude=.next \
|
|
--exclude=.deploy-stage -cf - . | (cd .deploy-stage && tar xf -)
|
|
|
|
- name: Probe FTP server
|
|
run: |
|
|
curl -sv --user "${{ secrets.FTP_USER }}:${{ secrets.FTP_PASS }}" \
|
|
"ftp://82.165.141.176/dev.karlderheinz.tv/" 2>&1 | tail -30 || true
|
|
|
|
- name: Upload source to server (FTP)
|
|
uses: SamKirkland/FTP-Deploy-Action@4.2.0
|
|
with:
|
|
server: 82.165.141.176
|
|
username: ${{ secrets.FTP_USER }}
|
|
password: ${{ secrets.FTP_PASS }}
|
|
local-dir: .deploy-stage/
|
|
remote-dir: /dev/karlderheinz.tv/
|
|
|
|
# TODO: trigger the server-side build + restart (next conversation)
|