Merge pull request #269 from LleidaHack/integration #329
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 VPS | |
on: | |
push: | |
branches: | |
- main | |
- integration | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT | |
id: extract_branch | |
- name: Push to server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
port: ${{ secrets.SERVER_PORT }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
script: | | |
cd ${{ secrets.PROJECT_PATH }}/${{ steps.extract_branch.outputs.branch }} | |
git fetch | |
git checkout ${{ steps.extract_branch.outputs.branch }} | |
git pull | |
rm -rf build | |
npm run build | |
sudo systemctl restart frontend.${{ steps.extract_branch.outputs.branch }} | |
- name: check server status | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
port: ${{ secrets.SERVER_PORT }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
script: | | |
systemctl status frontend.${{ steps.extract_branch.outputs.branch }}.service |