mirror of
https://github.com/Eglantine-Community/docs.git
synced 2026-11-22 06:29:24 -10:00
53 lines
1.3 KiB
YAML
53 lines
1.3 KiB
YAML
name: Deploy
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: deploy
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
OUT_DIR: build
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
environment: production
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- uses: pnpm/action-setup@v6 # reads "packageManager" from package.json
|
|
with:
|
|
version: 10 # only if package.json has no packageManager field
|
|
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: lts/*
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm build
|
|
|
|
- name: Sanity check build
|
|
run: test -f "$OUT_DIR/index.html"
|
|
|
|
- name: Deploy
|
|
env:
|
|
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
|
KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
|
|
run: |
|
|
install -m 700 -d ~/.ssh
|
|
printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts
|
|
rsync -rlz --delete --chmod=D755,F644 \
|
|
-e "ssh -p $DEPLOY_PORT" \
|
|
"$OUT_DIR"/ deploy@"$DEPLOY_HOST":/
|