-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a GitHub Action to build and deploy the frontend.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build & Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build-and-deploy: | ||
name: app.flowey.paveloom.dev | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build the frontend | ||
run: | | ||
cd frontend | ||
npm install | ||
npm run build | ||
- name: Deploy | ||
env: | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
SSH_KEY_PASS: ${{ secrets.SSH_KEY_PASS }} | ||
SSH_USERNAME: ${{ secrets.SSH_USERNAME }} | ||
SSH_HOST: ${{ secrets.SSH_HOST }} | ||
SSH_REMOTE_DIR: ${{ secrets.SSH_REMOTE_DIR }} | ||
run: | | ||
mkdir -p ~/.ssh/ && ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts 2>/dev/null | ||
eval $(ssh-agent -s) | ||
echo '#!/bin/sh' > ~/.ssh_askpass | ||
echo 'echo $SSH_KEY_PASS' > ~/.ssh_askpass && chmod 700 ~/.ssh_askpass | ||
echo "$SSH_KEY" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh_askpass ssh-add - | ||
rsync -avzh --delete-after frontend/dist/ "$SSH_USERNAME@$SSH_HOST:$SSH_REMOTE_DIR" |