🪶chore: update deploy-prod.yml (#13) #6
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 production server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
name: Deploy production build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [21.x] | |
steps: | |
- name: Deploying | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
script: | | |
# Change directory to project directory | |
cd mcevert/store-service | |
# Load environment variables | |
echo " | |
APP_NAME=${{ vars.APP_NAME }} | |
APP_ENV=${{ vars.APP_ENV }} | |
APP_PORT=${{ vars.APP_PORT }} | |
APP_URL=${{ vars.APP_URL }} | |
" > .env | |
# Pull newest code | |
git pull | |
# Install newest dependencies | |
yarn install --frozen-lockfile | |
# Build production code | |
yarn build | |
# Restart process manager | |
pm2 restart "store-service" |