Skip to content

Commit 8f89fe3

Browse files
authored
chore: add readme for declarative release (#50)
1 parent d4160f9 commit 8f89fe3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,37 @@ Set your service account password in the repository secrets setting with the nam
6464
> [!IMPORTANT]
6565
> The migration filename SHOULD comply to the naming scheme described in [bytebase-action](https://github.com/bytebase/bytebase/tree/main/action#global-flags) `--file-pattern` flag section.
6666

67+
### How to configure declarative-release-action.yml
68+
69+
Copy [declarative-release-action.yml](/.github/workflows/declarative-release-action.yml) to your repository.
70+
71+
This workflow uses declarative schema management. With declarative mode, you define the desired end state of your database schema, and Bytebase automatically generates and applies the necessary changes.
72+
73+
Modify the environment variables to match your setup.
74+
You need to edit the `create-rollout`, `deploy-to-test` and `deploy-to-prod` jobs.
75+
76+
```yml
77+
env:
78+
BYTEBASE_URL: https://demo.bytebase.com
79+
BYTEBASE_SERVICE_ACCOUNT: [email protected]
80+
BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{ secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET }}
81+
BYTEBASE_PROJECT: "projects/hr"
82+
# In the create-rollout job, set the database targets and file pattern
83+
BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_test,instances/prod-sample-instance/databases/hr_prod"
84+
FILE_PATTERN: "schema/*.sql"
85+
# In deploy-to-test job:
86+
BYTEBASE_TARGET_STAGE: environments/test
87+
# In deploy-to-prod job:
88+
BYTEBASE_TARGET_STAGE: environments/prod
89+
```
90+
91+
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.
92+
93+
Set your service account password in the repository secrets setting with the name `BYTEBASE_SERVICE_ACCOUNT_SECRET`.
94+
95+
> [!IMPORTANT]
96+
> You must export your initial schema files by clicking **Export Schema** in the database detail page on Bytebase and saving them to the `schema/` directory.
97+
6798
### How to configure chatops-migrate.yml
6899

69100
Copy [chatops-migrate.yml](/.github/workflows/chatops-migrate.yml) to your repository.

0 commit comments

Comments
 (0)