Skip to content

Navigation Menu

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

Appearance settings

feat: examples using bytebase-action #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions 75 .github/workflows/release-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Rollout using bytebase-action image

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build app and upload
run: |
echo "Building..."
echo "Build done!"
echo "Uploading..."
echo "Upload done!"
deploy-to-test:
needs: build
runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks.
environment: test
container:
image: docker://bytebase/bytebase-action:latest
outputs:
bytebase-plan: ${{ steps.set-output.outputs.plan }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: rollout
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BYTEBASE_URL: https://demo.bytebase.com
BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com
BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET}}
BYTEBASE_PROJECT: "projects/project-sample"
BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_test,instances/prod-sample-instance/databases/hr_prod"
BYTEBASE_TARGET_STAGE: environments/test
FILE_PATTERN: "migrations/*.sql"
BYTEBASE_OUTPUT: ${{ runner.temp }}/bytebase-metadata.json
run: |
bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --service-account=${{ env.BYTEBASE_SERVICE_ACCOUNT }} --service-account-secret=${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }} --project=${{ env.BYTEBASE_PROJECT }} --file-pattern=${{ env.FILE_PATTERN }} --targets=${{ env.BYTEBASE_TARGETS }} --target-stage=${{ env.BYTEBASE_TARGET_STAGE }} --output=${{ env.BYTEBASE_OUTPUT }}
- name: Set output
id: set-output
run: |
PLAN=$(jq -r .plan ${{ runner.temp }}/bytebase-metadata.json)
echo "plan=$PLAN" >> $GITHUB_OUTPUT
- name: Deploy app
run: |
echo "Deploying app to test environment..."
echo "Deploy app to test environment done!"
deploy-to-prod:
needs: deploy-to-test
runs-on: ubuntu-latest
environment: prod
container:
image: docker://bytebase/bytebase-action:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: rollout
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BYTEBASE_URL: https://demo.bytebase.com
BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com
BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET}}
BYTEBASE_PROJECT: "projects/project-sample"
BYTEBASE_TARGET_STAGE: environments/prod
run: |
bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --service-account=${{ env.BYTEBASE_SERVICE_ACCOUNT }} --service-account-secret=${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }} --project=${{ env.BYTEBASE_PROJECT }} --target-stage=${{ env.BYTEBASE_TARGET_STAGE }} --plan=${{ needs.deploy-to-test.outputs.bytebase-plan }}
- name: Deploy app
run: |
echo "Deploying app to prod environment..."
echo "Deploy app to prod environment done!"
2 changes: 1 addition & 1 deletion 2 .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and push release image
name: Rollout

on:
push:
Expand Down
30 changes: 30 additions & 0 deletions 30 .github/workflows/sql-review-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: SQL review on pull request using bytebase-action image

on:
pull_request:
branches:
- main
paths:
- "migrations/*.sql"

jobs:
check-release-on-prod:
permissions:
pull-requests: write # write permission required to allow the action writes the check results to the comment.
runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks.
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check release
uses: docker://bytebase/bytebase-action:latest
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.com
BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com
BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET}}
BYTEBASE_PROJECT: "projects/project-sample"
BYTEBASE_TARGETS: "instances/prod-sample-instance/databases/hr_prod"
FILE_PATTERN: "migrations/*.sql"
with:
entrypoint: bytebase-action
args: check --url ${{ env.BYTEBASE_URL }} --service-account ${{ env.BYTEBASE_SERVICE_ACCOUNT }} --project ${{ env.BYTEBASE_PROJECT }} --targets ${{ env.BYTEBASE_TARGETS }} --file-pattern ${{ env.FILE_PATTERN }}
1 change: 0 additions & 1 deletion 1 migrations/202503141135_sleep.sql

This file was deleted.

2 changes: 1 addition & 1 deletion 2 migrations/202503181018_ticket_table_add_date_column.sql
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE IF EXISTS ticket ADD release_date DATE;
ALTER TABLE IF EXISTS ticket ADD IF NOT EXISTS release_date DATE;
3 changes: 3 additions & 0 deletions 3 migrations/202504171429_1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE TABLE IF NOT EXISTS wer (
id int
);
3 changes: 3 additions & 0 deletions 3 migrations/202504171526_2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE TABLE IF NOT EXISTS oijoir (
id int
);
3 changes: 3 additions & 0 deletions 3 migrations/202504301754_1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE TABLE IF NOT EXISTS geoiwjgoiwerjg (
id int
);
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.