Example GitHub Action Scripts
Published 09 May 2024
Migrate
The following example uses Flyway on Docker and migrates pending migrations to a target database whose connection information is stored in secrets. Your flyway license key is also stored as a secret.
name: 'Flyway Migrate' on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Run Flyway Migrate uses: docker://redgate/flyway:10 with: args: >- migrate -workingDirectory="/github/workspace/" -url="${{ secrets.FLYWAY_URL }}" -user="${{ secrets.FLYWAY_USER }}" -password="${{ secrets.FLYWAY_PASSWORD }}" env: FLYWAY_LICENSE_KEY: ${{ secrets.FLYWAY_LICENSE_KEY }}
Change and Drift Reports
The following example uses Flyway on Docker and generates a change and drift report. Your target database connection information is stored in secrets and a build environments has been defined in the project's TOML settings. Your flyway license key is also stored as a secret.
name: 'Flyway Report' on: pull_request jobs: report: runs-on: ubuntu-latest steps: - name: Run Flyway Report uses: docker://redgate/flyway:10 with: args: >- check -changes -drift -workingDirectory="/github/workspace/" -url="${{ secrets.FLYWAY_URL }}" -user="${{ secrets.FLYWAY_USER }}" -password="${{ secrets.FLYWAY_PASSWORD }}" -check.buildEnvironment="build" env: FLYWAY_LICENSE_KEY: ${{ secrets.FLYWAY_LICENSE_KEY }}