Show deploy button in GitHub Actions tab #156
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: Transport API deploy | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
- .gitignore | |
- client/** | |
jobs: | |
deploy: | |
name: Build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.API_SERVER_HOST }} | |
username: ${{ secrets.API_SERVER_USERNAME }} | |
password: ${{ secrets.API_SERVER_PASSWORD }} | |
script: | | |
cd ${{ secrets.API_SERVER_FOLDER }} | |
git checkout main | |
git fetch | |
git reset --hard origin/main | |
git clean -df | |
git pull | |
# Fix NVM appleboy/ssh-action | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
nvm use | |
export APP_PORT=${{ secrets.API_SERVER_PORT }} | |
export NODE_ENV=production | |
pnpm -r --filter transport-server --filter transport-common i | |
pnpm build:common | |
pnpm build:server | |
pm2 delete transport-server | |
pm2 start --name transport-server pnpm -- start:server |