fix: refactor on auth and role (#184) #57
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: Auth Deployment | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [main] | |
# pull_request: | |
# branches: [main] | |
jobs: | |
test_app_runs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: install dependencies | |
run: | | |
pnpm install | |
# node index.js | |
# n=0 | |
# until [ $n -ge 30 ]; do | |
# curl -I -X GET http://localhost:4000/api/auth/api/docs && break | |
# n=$[$n+1] | |
# sleep 10 | |
# done | |
# if [ $n -ge 30 ]; then | |
# echo "App did not start successfully" | |
# exit 1 | |
# fi | |
deploy: | |
runs-on: ubuntu-latest | |
needs: test_app_runs | |
steps: | |
- uses: actions/checkout@v3 | |
- name: run app | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST_STAGING }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: | | |
su - devops | |
cd /home/devops/authentication_service | |
git stash | |
git pull origin main | |
pnpm install | |
npx pm2 restart auth |