Merge pull request #99 from DartExplore/issue#algo #25
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: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build with Vite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
env: | |
VITE_API_URL: "https://api.dallasbymetro.com" | |
run: npm run build | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-build | |
path: dist/* | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: app-build | |
path: dist/ | |
- name: Copy files | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.EC2HOSTNAME }} | |
username: ${{ secrets.EC2USERNAME }} | |
key: ${{ secrets.EC2SSH_KEY }} | |
source: "dist/*" | |
target: "/home/ubuntu/dallasByMetro" | |
- name: Restart service | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2HOSTNAME }} | |
username: ${{ secrets.EC2USERNAME }} | |
key: ${{ secrets.EC2SSH_KEY }} | |
script: | | |
/home/ubuntu/.nvm/versions/node/v18.16.0/bin/pm2 reload default |