Merge pull request #109 from ddxv/main #662
This file contains hidden or 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: Push-to-Server | |
| # Trigger deployment only on push to main branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| name: Deploy to cloud on main branch push | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Checkout the files | |
| uses: actions/checkout@v3 | |
| - name: Deploy to server | |
| uses: appleboy/ssh-action@master | |
| env: | |
| TARGETDIR: appgoblin | |
| with: | |
| host: ${{ secrets.HOST_DNS }} | |
| username: ${{ vars.USERNAME }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| port: 22 | |
| envs: TARGETDIR | |
| script: | | |
| cd $TARGETDIR | |
| echo "Pulling latest code..." | |
| git pull origin main | |
| chmod +x /home/goblin/appgoblin/scripts/deploy.sh | |
| ./scripts/deploy.sh | |