Deploy #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
deployEpitech: | |
runs-on: ubuntu-latest | |
name: Deploy to EPITECH Repository | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_EPITECH_KEY }} | |
- name: Clone EPITECH repository | |
run: | | |
git clone [email protected]:EpitechPromo2026/G-EIP-700-PAR-7-1-eip-jules.gresset.git | |
cd G-EIP-700-PAR-7-1-eip-jules.gresset | |
mkdir -p -v Back-End | |
rsync -av --delete ../ Back-End/ --exclude .git --exclude G-EIP-700-PAR-7-1-eip-jules.gresset/ | |
- name: Configure Git | |
run: | | |
git config --global user.name "Jules Gresset" | |
git config --global user.email "[email protected]" | |
- name: Push to EPITECH repository | |
run: | | |
cd G-EIP-700-PAR-7-1-eip-jules.gresset | |
git add . | |
git commit -m "Update from Back-End (Automation)" | |
git push origin main | |
deployVPSCA: | |
runs-on: ubuntu-latest | |
name: Deploy to VPS CA | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.X' | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Deploy to VPS CA | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.VPS_CA_SSH }} | |
ARGS: "-rlgoDzvc --delete" | |
REMOTE_HOST: ${{ secrets.VPS_CA_HOST }} | |
REMOTE_USER: ${{ secrets.VPS_CA_USERNAME }} | |
TARGET: ${{ secrets.VPS_CA_TARGET }} | |
EXCLUDE: "/node_modules/" | |
SCRIPT_AFTER: | | |
echo "DB_NAME=\"${{ secrets.BACKEND_DB_NAME }}\"" >> ${{ secrets.VPS_CA_TARGET }}.env | |
echo "DB_URL=\"${{ secrets.BACKEND_DB_URL }}\"" >> ${{ secrets.VPS_CA_TARGET }}.env | |
echo "SALT_HASH=\"${{ secrets.BACKEND_SALT }}\"" >> ${{ secrets.VPS_CA_TARGET }}.env | |
sleep 2 | |
./restartBackend.sh | |
SCRIPT_AFTER_REQUIRED: true | |
deployVPSUK: | |
runs-on: ubuntu-latest | |
name: Deploy to VPS UK | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.X' | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Deploy to VPS CA | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.VPS_UK_SSH }} | |
ARGS: "-rlgoDzvc --delete" | |
REMOTE_HOST: ${{ secrets.VPS_UK_HOST }} | |
REMOTE_USER: ${{ secrets.VPS_UK_USERNAME }} | |
TARGET: ${{ secrets.VPS_UK_TARGET }} | |
EXCLUDE: "/node_modules/" | |
SCRIPT_AFTER: | | |
echo "DB_NAME=\"${{ secrets.BACKEND_DB_NAME }}\"" >> ${{ secrets.VPS_UK_TARGET }}.env | |
echo "DB_URL=\"${{ secrets.BACKEND_DB_URL }}\"" >> ${{ secrets.VPS_UK_TARGET }}.env | |
echo "SALT_HASH=\"${{ secrets.BACKEND_SALT }}\"" >> ${{ secrets.VPS_UK_TARGET }}.env | |
sleep 2 | |
./restartBackend.sh | |
SCRIPT_AFTER_REQUIRED: true |