diff --git a/docs/howto/ci-cd.md b/docs/howto/ci-cd.md index 37c75ec5be..7368811001 100644 --- a/docs/howto/ci-cd.md +++ b/docs/howto/ci-cd.md @@ -41,6 +41,10 @@ to speed up the installation process. ## GitHub Workflows +We suggest running `diff`, `vet` and `upload` as part of your workflow. + +### diff + The following GitHub Workflow configuration runs `sqlc diff` on every push. ```yaml @@ -53,10 +57,12 @@ jobs: - uses: actions/checkout@v3 - uses: sqlc-dev/setup-sqlc@v3 with: - sqlc-version: '1.19.0' + sqlc-version: '1.22.0' - run: sqlc diff ``` +### vet + The following GitHub Workflow configuration runs [`sqlc vet`](vet.md) on every push. You can use `sqlc vet` without a database connection, but you'll need one if your `sqlc` configuration references the built-in `sqlc/db-prepare` lint rule. @@ -85,11 +91,33 @@ jobs: - uses: actions/checkout@v3 - uses: sqlc-dev/setup-sqlc@v3 with: - sqlc-version: '1.19.0' + sqlc-version: '1.22.0' # Connect and migrate your database here. This is an example which runs # commands from a `schema.sql` file. - run: psql -h localhost -U postgres -p $PG_PORT -d postgres -f schema.sql env: PGPASSWORD: postgres - run: sqlc vet +``` + +### upload + +The following GitHub Workflow configuration runs [`sqlc upload`](upload.md) on +every push to `main`. + +```yaml +name: sqlc +on: [push] +jobs: + upload: + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/main' }} + steps: + - uses: actions/checkout@v3 + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.22.0' + - run: sqlc upload + env: + SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} ``` \ No newline at end of file diff --git a/scripts/bump-version/main.go b/scripts/bump-version/main.go index 2047de99fb..aaf3f58532 100644 --- a/scripts/bump-version/main.go +++ b/scripts/bump-version/main.go @@ -100,7 +100,7 @@ func run(current, next string, realmode bool) error { return nil } switch filepath.Ext(path) { - case ".go", ".kt", ".py", ".json": + case ".go", ".kt", ".py", ".json", ".md": c, err := os.ReadFile(path) if err != nil { return err @@ -109,12 +109,16 @@ func run(current, next string, realmode bool) error { new := strings.ReplaceAll(old, `"sqlc_version": "v`+current, `"sqlc_version": "v`+next) + new = strings.ReplaceAll(new, + `sqlc-version: "`+current, + `sqlc-version: "`+next) + new = strings.ReplaceAll(new, + `sqlc-version: '`+current, + `sqlc-version: '`+next) new = strings.ReplaceAll(new, "sqlc v"+current, "sqlc v"+next) new = strings.ReplaceAll(new, "SQLC_VERSION=v"+current, "SQLC_VERSION=v"+next) - if realmode { - if err := os.WriteFile(path, []byte(new), 0644); err != nil { - return fmt.Errorf("write error: %s: %w", path, err) - } + if err := write(path, old, new); err != nil { + return err } default: } @@ -135,5 +139,12 @@ func run(current, next string, realmode bool) error { } } + { + p := filepath.Join("docs") + if err := filepath.Walk(p, walker); err != nil { + return err + } + } + return nil }