Merge pull request #588 from PAWECOGmbH/development #34
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 and Run Flyway Migrations staging | |
on: | |
push: | |
branches: | |
- staging | |
jobs: | |
deploy_and_migrate: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Deploy to server via rsync | |
uses: Burnett01/[email protected] | |
with: | |
switches: -avzr --checksum --delete --exclude-from='.gitignore' --exclude='/config/nginx/conf.d/custom.conf' | |
path: ./ | |
remote_path: ${{ secrets.STAGING_REMOTE_PATH }} | |
remote_host: ${{ secrets.STAGING_HOST }} | |
remote_user: ${{ secrets.STAGING_USER }} | |
remote_key: ${{ secrets.STAGING_KEY }} | |
remote_key_pass: ${{ secrets.STAGING_KEY_PASS }} | |
- name: Run Flyway Migrations core | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.STAGING_HOST }} | |
username: ${{ secrets.STAGING_USER }} | |
key: ${{ secrets.STAGING_KEY }} | |
passphrase: ${{ secrets.STAGING_KEY_PASS }} | |
script: | | |
docker run --rm \ | |
--network npm_network \ | |
--volume ${{ secrets.STAGING_REMOTE_PATH }}/config/db/core:/flyway/core:ro \ | |
-e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ | |
-e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ | |
-e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ | |
flyway/flyway -locations=filesystem:/flyway/core -table=flyway_core migrate | |
- name: Run Flyway Migrations myapp | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.STAGING_HOST }} | |
username: ${{ secrets.STAGING_USER }} | |
key: ${{ secrets.STAGING_KEY }} | |
passphrase: ${{ secrets.STAGING_KEY_PASS }} | |
script: | | |
docker run --rm \ | |
--network npm_network \ | |
--volume ${{ secrets.STAGING_REMOTE_PATH }}/config/db/myapp:/flyway/myapp:ro \ | |
-e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ | |
-e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ | |
-e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ | |
flyway/flyway -locations=filesystem:/flyway/myapp -table=flyway_myapp migrate |