57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Build and Deploy to Production
|
|
runs-on: docker
|
|
steps:
|
|
- name: Checkout code
|
|
run: |
|
|
git clone --depth 1 --branch main https://forge.studio-variable.com/${{ github.repository }}.git .
|
|
ls -la
|
|
|
|
- name: Setup Node.js
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq curl
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
|
apt-get install -y -qq nodejs
|
|
node --version
|
|
npm --version
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm ci
|
|
|
|
- name: Prepare dist directory
|
|
run: |
|
|
rm -rf dist
|
|
cp -r public dist
|
|
ls -la dist/
|
|
|
|
- name: Build Vue app
|
|
run: |
|
|
npm run build
|
|
ls -la dist/assets/dist/
|
|
|
|
- name: Deploy via FTP
|
|
env:
|
|
USERNAME: ${{ secrets.USERNAME }}
|
|
PASSWORD: ${{ secrets.PASSWORD }}
|
|
PRODUCTION_HOST: ${{ secrets.PRODUCTION_HOST }}
|
|
run: |
|
|
apt-get install -y -qq lftp
|
|
cd dist
|
|
lftp -u "$USERNAME","$PASSWORD" "$PRODUCTION_HOST" <<'EOF'
|
|
set ftp:ssl-allow no
|
|
mirror --reverse --verbose --ignore-time --parallel=10 -x local/ assets assets
|
|
mirror --reverse --verbose --ignore-time --parallel=10 -x accounts/ -x cache/ -x sessions/ site site
|
|
mirror --reverse --verbose --ignore-time --parallel=10 kirby kirby
|
|
mirror --reverse --verbose --ignore-time --parallel=10 vendor vendor
|
|
put index.php -o index.php
|
|
quit
|
|
EOF
|