Skip to content
database

GitHub Action

Flyway Migration

v3.0.0 Latest version

Flyway Migration

database

Flyway Migration

Migrate database in Github Action

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Flyway Migration

uses: joshuaavalon/flyway-action@v3.0.0

Learn more about this action in joshuaavalon/flyway-action

Choose a version

Flyway Action [Deprecated]

You can run the Docker image directly without using this action.

- uses: docker://flyway/flyway:9
  env:
    FLYWAY_URL: jdbc:postgresql://postgres:5432/db
    FLYWAY_USER: user
    FLYWAY_PASSWORD: password
    FLYWAY_LOCATIONS: filesystem:./sql
    FLYWAY_VALIDATE_MIGRATION_NAMING: true

This action runs Flyway v9 to migrate database. It aims to migrate database for testing in workflows.

Usage

name: Main
on:
  - push
jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres
        env:
          POSTGRES_DB: db
          POSTGRES_USER: user
          POSTGRES_PASSWORD: password
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v2
      - uses: joshuaavalon/flyway-action@v3.0.0
        with:
          url: jdbc:postgresql://postgres:5432/db
          user: user
          password: password
      - run: echo 'testing'

Currently, it supports url, user, password, initSql and locations. locations are default to filesystem:./sql.

Extra configurations can be passed via environment variables.

- uses: joshuaavalon/flyway-action@v3.0.0
  with:
    url: jdbc:postgresql://postgres:5432/db
    user: user
    password: password
  env:
    FLYWAY_VALIDATE_MIGRATION_NAMING: true

For details, please check out Flyway documentation.