October 22, 2020
Introducing the Official Liquibase GitHub Action Plugin
See Liquibase in Action
Accelerate database changes, reduce failures, and enforce governance across your pipelines.
In honor of Hacktoberfest, Liquibase hosted a day-long internal Hackathon. My team’s challenge: make it easier to use Liquibase in Continuous Integration and Continuous Delivery (CI/CD) systems. Today, we’re happy to announce the official Liquibase plugin for GitHub Actions CI/CD!
Official Liquibase GitHub Action
The official Liquibase GitHub Action follows GitHub best practices. If you’re familiar with GitHub Actions, you’ll be comfortable consuming it right away. If you’re new, I’ve got an example you can try.
This new plugin supports Liquibase commands that are most useful for automation, including:
- update
- updateCount
- tag
- updateToTag
- rollback
- rollbackCount
- rollbackToDate
- updateSQL
- futureRollbackSQL
- status
- history
- diff
The Action also accepts required parameters such as database URL, credentials, and more. Prior to running a command, the Action will validate both the database credentials and the required command parameters are present.
How to use it
To use the official Liquibase GitHub Action in your project, add a new uses: tag to your Workflow YAML file that references liquibase/liquibase-github-action@v2. Modify the with: tag as appropriate to define the Liquibase command (operation) to execute and other parameters. The README in the Action’s repository provides two examples as well as information on required and optional inputs.
Liquibase. GitHub. Action!
Want to see the plugin in action? We created an example repository just for you! The only prerequisite is some knowledge of Git.
Here are the steps to use the example:
- Clone the liquibase-github-action-example repository into a GitHub repository of you own.
- Create a new git branch for your changes.
- Add a new changeset to example/changelogs/samplechangelog.h2.sql. For example:
--changeset your.name:4
--rollback DROP TABLE yourname;
CREATE TABLE yourname (
id int primary key,
name varchar(50) not null,
)
- Add, commit, and push your changes to your GitHub repository.
- See your commit trigger a build in GitHub and execute Liquibase update!
More Examples!
Want to learn about other ways to use Liquibase? We’ve included a folder full of examples that use other build systems, like Gradle or NodeJs. These examples don’t use the official GitHub Action (which is Docker-based) but allow for impressive automation.
Team CICD Plugins was led by Jake Newton and combined the mental might of Nathan Voxland, Derek Smart, Robert Reeves, Mike Olivas, Adeel Malik, Mike Runco, Dan Zentgraf, and Erzsebet Carmean.