geni 1.1.8

A standalone database CLI migration tool
Documentation
name: emilpriver/geni
description: Migrate your migrations using geni
branding:
  icon: database
  color: green
author: emilpriver

inputs:
  migrations_folder:
    required: false
    default: "./migrations"
  wait_timeout:
    required: false
    default: "30"
  migrations_table:
    required: false
    default: ""
  database_url:
    required: true
  database_token:
    default: ""
    required: false
runs:
  using: "composite"
  steps:
    - name: Migrate using Geni
      run: |
        USER_REPO="emilpriver/geni"
        LATEST_TAG=$(curl -s https://api.github.com/repos/$USER_REPO/releases/latest | grep 'tag_name' | cut -d '"' -f 4)
        OS="$(uname -s)"
        case "$OS" in
        Linux*)
          OS_TYPE='linux'
          BINARY_SUFFIX='linux-amd64'
          ;;
        Darwin*)
          OS_TYPE='macos'
          BINARY_SUFFIX='macos-amd64'
          ;;
        CYGWIN* | MINGW32* | MSYS* | MINGW*)
          OS_TYPE='windows'
          BINARY_SUFFIX='windows-amd64'
          ;;
        *)
          echo "Unsupported OS: $OS"
          exit 1
          ;;
        esac

        DOWNLOAD_URL="https://github.com/$USER_REPO/releases/download/$LATEST_TAG/geni-$BINARY_SUFFIX"

        curl -L $DOWNLOAD_URL -o geni_binary
        if [ "$OS_TYPE" != "windows" ]; then
          chmod +x geni_binary
        fi

        ./geni_binary up
      shell: bash
      env:
        DATABASE_MIGRATIONS_FOLDER: ${{ inputs.migrations_folder }}
        DATABASE_URL: ${{ inputs.database_url }}
        DATABASE_TOKEN: ${{inputs.database_token}}
        DATABASE_WAIT_TIMEOUT: ${{inputs.wait_timeout}}
        DATABASE_NO_DUMP_SCHEMA: "false"
        DATABASE_MIGRATIONS_TABLE: ${{inputs.migrations_table}}