61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
name: Test and deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Check out the site
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Generate website data
|
|
run: npm run update:generated
|
|
|
|
- name: Test the site
|
|
run: npm test
|
|
|
|
- name: Install deployment tools
|
|
run: |
|
|
apt-get update
|
|
apt-get install --yes --no-install-recommends openssh-client rsync
|
|
|
|
- name: Configure deployment SSH key
|
|
env:
|
|
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
|
|
run: |
|
|
install -d -m 0700 "$HOME/.ssh"
|
|
printf '%s\n' "$DEPLOY_SSH_KEY" > "$HOME/.ssh/deploy_key"
|
|
printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
|
|
chmod 0600 "$HOME/.ssh/deploy_key" "$HOME/.ssh/known_hosts"
|
|
|
|
- name: Upload the website
|
|
env:
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
run: |
|
|
rsync \
|
|
--archive \
|
|
--compress \
|
|
--delete \
|
|
--delay-updates \
|
|
--human-readable \
|
|
--itemize-changes \
|
|
--rsh "ssh -i $HOME/.ssh/deploy_key -o IdentitiesOnly=yes" \
|
|
web/ \
|
|
"firewallissues-deploy@${DEPLOY_HOST}:/var/www/html/firewallissues/web/"
|