Files
PortFolio/.gitea/workflows/cd build.yml
Morph01 aac41fd363
All checks were successful
Linux arm64 / Build-and-Deploy (push) Successful in 39s
Update build.yml with test deploy with brain
2024-11-23 16:47:59 +00:00

49 lines
1.2 KiB
YAML

name: Linux arm64
run-name: Build and Deploy Portfolio
on: [push]
jobs:
Build-and-Deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install dependencies and build
run: |
npm ci
npm run build
- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_KEY_PORTFOLIO }}
- name: Add remote host to known_hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H git.ale-pri.com >> ~/.ssh/known_hosts
- name: Upload build folder to temporary directory on remote server
run: |
scp -r build ubuntu@git.ale-pri.com:Poubelle/portfolio
- name: Deploy to final directory on remote server
run: |
ssh ubuntu@git.ale-pri.com << 'EOF'
BUILD_TMP=Poubelle/portfolio
DEPLOY_DIR=/var/www/portfolio
sudo mkdir -p $DEPLOY_DIR
sudo rsync -a --delete $BUILD_TMP/ $DEPLOY_DIR/
sudo chown -R www-data:www-data $DEPLOY_DIR
sudo chmod -R 755 $DEPLOY_DIR
sudo rm -rf $BUILD_TMP
sudo nginx -t && sudo systemctl reload nginx
EOF