Changed the deployment branch to fallback-for-facilities-page-fix #361
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: CI | |
on: | |
push: | |
branches: [ fallback-for-facilities-page-fix ] | |
env: | |
NEXT_PUBLIC_API_URL: 'https://api.kmhfr.health.go.ke/api' | |
TOKEN_URL: 'https://api.kmhfr.health.go.ke/o/token' | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
GRANT_TYPE: 'password' | |
NEXT_PUBLIC_CLIENT_USERNAME: 'public@mfltest.slade360.co.ke' | |
CLIENT_PASSWORD: ${{secrets.CLIENT_PASSWORD}} | |
NEXT_PUBLIC_CLIENT_PUBLIC_ID: ${{secrets.NEXT_PUBLIC_CLIENT_PUBLIC_ID}} | |
CLIENT_PUBLIC_SECRET: ${{secrets.CLIENT_PUBLIC_SECRET}} | |
NEXT_PUBLIC_PUBLIC_TOKEN_URL: 'https://api.kmhfr.health.go.ke/o/token/' | |
NEXT_PUBLIC_FACILITY_EXPORT_URL: 'https://api.kmhfr.health.go.ke/api/facilities/material/' | |
jobs: | |
# test: | |
# timeout-minutes: 60 | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: 16 | |
# - name: Install build dependecies | |
# run: yarn global add pnpm && yarn global add playwright | |
# - name: Install Playwright Browsers | |
# run: pnpm exec playwright install --with-deps | |
# - name: Install App dependencies | |
# run: pnpm install | |
# - name: Run Playwright tests | |
# run: pnpm run test | |
# - uses: actions/upload-artifact@v3 | |
# if: always() | |
# with: | |
# name: playwright-report | |
# path: playwright-report/ | |
# retention-days: 30 | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Build Dependencies | |
run : yarn global add pm2; yarn global add pnpm | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
port: ${{ secrets.SERVER_PORT }} | |
username: ${{ secrets.SERVER_USER }} | |
password: ${{ secrets.SERVER_KEY }} | |
script: | | |
set -e | |
cd /var/www/kmhfr | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
if ! [[ -d './.git' ]]; then git init; fi | |
if ! [[ `git remote -v | awk '{print $1}' | head -n 1` =~ 'origin' ]]; then git remote add origin ${{ github.server_url }}${{ github.username }}/${{ github.repository }}.git; fi | |
git stash | |
git pull origin fallback-for-facilities-page-fix | |
pnpm install | |
pnpm run build | |
pnpm dlx pm2 startOrRestart ecosystem.config.js --env local | |
pnpm dlx pm2 save | |