|
| 1 | +name: Deploy to Apache |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + deploy: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout repository |
| 14 | + uses: actions/checkout@v3 |
| 15 | + |
| 16 | + - name: Deploy Website |
| 17 | + uses: burnett01/rsync-deployments@6.0.0 |
| 18 | + with: |
| 19 | + switches: -avzr --delete |
| 20 | + path: src/ |
| 21 | + remote_path: /var/www/html/ |
| 22 | + remote_host: ${{ secrets.SERVER_HOST }} |
| 23 | + remote_port: ${{ secrets.SERVER_PORT }} |
| 24 | + remote_user: ${{ secrets.SERVER_USERNAME }} |
| 25 | + remote_key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 26 | + |
| 27 | + - name: Deploy database migrations |
| 28 | + uses: burnett01/rsync-deployments@6.0.0 |
| 29 | + with: |
| 30 | + switches: -avzr --delete |
| 31 | + path: db/ |
| 32 | + remote_path: /var/www/html/db/ |
| 33 | + remote_host: ${{ secrets.SERVER_HOST }} |
| 34 | + remote_port: ${{ secrets.SERVER_PORT }} |
| 35 | + remote_user: ${{ secrets.SERVER_USERNAME }} |
| 36 | + remote_key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 37 | + |
| 38 | + - name: Run Flyway migrations |
| 39 | + uses: appleboy/ssh-action@v1.0.3 |
| 40 | + with: |
| 41 | + host: ${{ secrets.SERVER_HOST }} |
| 42 | + port: ${{ secrets.SERVER_PORT }} |
| 43 | + username: ${{ secrets.SERVER_USERNAME }} |
| 44 | + key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 45 | + script: | |
| 46 | + set -e |
| 47 | +
|
| 48 | + flyway \ |
| 49 | + -url='${{ secrets.DB_URL }}' \ |
| 50 | + -user='${{ secrets.DB_USER }}' \ |
| 51 | + -password='${{ secrets.DB_PASS }}' \ |
| 52 | + -locations='filesystem:/var/www/html/db/migrations' \ |
| 53 | + migrate |
| 54 | +
|
| 55 | + echo "Migrations complete" |
0 commit comments