Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Database CI/CD and schema migration with GitHub flow using Bytebase and GitHub actions

License

NotificationsYou must be signed in to change notification settings

dungphan101/example-gitops-github-flow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This repository demonstrates how to use Bytebase and GitHub actions to do database release CI/CD with a code base followingGitHub flow.

For GitHub flow, feature branches are merged into the main branch and the main branch is deployed to the, for example, "test" and "prod" environments in a deploy pipeline.

sql-review.yml checks the SQL migration files against the databases when pull requests are created.

release.yml builds the code and then for each environment migrate the databases and deploy the code. Usingenvironments with protection rules, it can deploy to the test environment automatically and push to the prod environment after approval.

How to configure sql-review.yml

Copysql-review.yml to your repository.

Modify the environment variables to match your setup.

env:GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}# set GITHUB_TOKEN because the 'Check release' step needs it to comment the pull request with check results.BYTEBASE_URL:https://demo.bytebase.comBYTEBASE_SERVICE_ACCOUNT:ci@service.bytebase.comBYTEBASE_PROJECT:"projects/project-sample"BYTEBASE_TARGETS:"instances/test-sample-instance/databases/hr_test"# the database targets to check against.FILE_PATTERN:"migrations/*.sql"# the glob pattern matching the migration files.

Set your service account password in the repository secrets setting with the nameBYTEBASE_SERVICE_ACCOUNT_SECRET.

Important

The migration filename SHOULD comply to the naming scheme described inbytebase/create-release-action.

How to configure release.yml

Copyrelease.yml to your repository.

Modify the environment variables to match your setup.

env:BYTEBASE_URL:https://demo.bytebase.comBYTEBASE_SERVICE_ACCOUNT:ci@service.bytebase.comBYTEBASE_PROJECT:"projects/project-sample"# The Bytebase rollout pipeline will deploy to 'test' and 'prod' environments.# 'deploy_to_test' job rollouts the 'test' stage and 'deploy_to_prod' job rollouts the 'prod' stage.BYTEBASE_TARGETS:"instances/test-sample-instance/databases/hr_test,instances/prod-sample-instance/databases/hr_prod"FILE_PATTERN:"migrations/*.sql"# the glob pattern matching the migration files.

In the repository environments setting, create two environments: "test" and "prod". In the "prod" environment setting, configure "Deployment protection rules", check "Required reviewers" and add reviewers in order to rollout the "prod" environment after approval.

Set your service account password in the repository secrets setting with the nameBYTEBASE_SERVICE_ACCOUNT_SECRET.

Important

The migration filename SHOULD comply to the naming scheme described inbytebase/create-release-action.

About

Database CI/CD and schema migration with GitHub flow using Bytebase and GitHub actions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp