GitHub Actions Workflow Setup

If you don’t want to install Liquibase locally on your laptop or use a remote host that will run the software for you, you can try the Liquibase GitHub Actions workflow.

GitHub Actions is a way to automate, customize, and execute your software development workflows in a repository. You can create and share actions to perform any job, including CI/CD, and combine actions in a customized workflow.

  • A workflow is an automated procedure that you add to your repository. Workflows are made up of one or more jobs and can be scheduled or triggered by an event. The workflow can be used to build, test, package, release, or deploy a project on GitHub.
  • A job is a set of steps that is executed on the same runner.

Note: For more information about GitHub Actions, see Introduction to GitHub Actions.

Prerequisites

Ensure that you have a GitHub account.

Note: For more information on how to create a GitHub account, see Signing Up for GitHub.

Using GitHub Actions for Liquibase

Using GitHub Actions, you can set the type of VM instance you want to run and the GitHub Actions you want to perform during a job in a workflow.

For Liquibase, you can use the Liquibase GitHub Actions repository with setup workflows. This repository contains a README file with instructions to follow, Liquibase project, and an H2 database with GitHub Actions workflows for the following setups:

  • Liquibase Command Line Interface (CLI)
  • Liquibase Maven commands with Spring Boot
  • Liquibase Gradle commands
  • Liquibase running in Docker

There are corresponding files for each project in the repository:

Project Folder Files

Liquibase software

Liquibase

Liquibase software

Liquibase CLI commands

H2_project

The liquibase.properties and changelog files

Gradle

Gradle_h2

The build.gradle file

Maven

SalesManager_h2_version

The pom.xml and application.properties Spring Boot class java files

Docker

Docker

The changelog file

How to use the Liquibase GitHub Actions repository

To use the Liquibase GitHub Actions repository, follow these steps:

  1. Open and fork the repository by selecting the Fork button in the upper-right corner of the page. For more information about forking, see Forking Projects.
  2. In the browser, go to your GitHub githubActions-liquibase repository, and then under the Workflow section, go to Actions.
  3. Choose the needed workflow, and then select run workflow.

To adjust your workflow, go to the workflow script in githubActions-liquibase/.github/workflows/<workflow name>.yaml and make the needed changes. You can add more commands and flags to the workflow script.

To add and change a changelog or edit the liquibase.properties file, modify them in the repository and then commit your changes without installing the files locally.

Related Links