while1618 started CI #40
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: Deploy CI | |
| run-name: ${{ github.actor }} started CI | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Fail if not on master | |
| if: github.ref != 'refs/heads/master' | |
| run: echo "This workflow can only be run on the master branch." && exit 1 | |
| - name: Fail if not run by owner | |
| if: github.actor != 'while1618' | |
| run: echo "This workflow can only be run by the owner." && exit 1 | |
| - name: Copy compose file to server | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} | |
| source: docker-compose.prod.yml | |
| target: ~/bugzkit/ | |
| - name: Deploy with Docker Compose | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} | |
| script: | | |
| cd ~/bugzkit | |
| docker compose -f docker-compose.prod.yml pull | |
| docker compose -f docker-compose.prod.yml up -d --remove-orphans |