Files
aranroig.com/.gitea/workflows/deploy.yml
BinarySandia04 037fea5113
Some checks failed
Build and Deploy Nuxt / build (push) Has been cancelled
Now yes
2026-03-11 19:40:43 +01:00

52 lines
1.2 KiB
YAML

name: Build and Deploy Nuxt
on:
push:
branches: [master]
jobs:
build:
runs-on: docker
container:
image: node:20
defaults:
run:
working-directory: ./aranroig
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install SSH client
run: |
apt-get update && apt-get install -y openssh-client
- name: Setup SSH inside container
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY_LOCATION }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# Add the container host to known_hosts
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: Install deps
run: npm i
- name: Build
run: npm run build
- name: Compress build
run: tar -czf build.tar.gz .output
- name: Deploy to server
run: |
scp build.tar.gz deploy@${{ secrets.DEPLOY_HOST }}:/tmp/
ssh deploy@{{ secrets.DEPLOY_HOST }} << 'EOF'
rm -rf /var/www/app/.output
tar -xzf /tmp/build.tar.gz -C /var/www/app
sudo systemctl restart app
EOF