Skip to content

Commit

Permalink
chore: prepare Go modules for the next release (#929)
Browse files Browse the repository at this point in the history
* chore: support for skipping git/curl operations

* chore: prepare for next release
  • Loading branch information
mdelapenya authored Mar 8, 2023
1 parent 843b27e commit 2f49f6e
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 23 deletions.
14 changes: 10 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ First, it's really important that you first check that the [version.go](./intern
Once the version file is correct in the repository:

- Run the [release.sh](./scripts/release.sh) shell script to run it in dry-run mode.
- You can run the script without dry-run setting `DRY_RUN=false` in the environment:
- You can use the `DRY_RUN`variable to enable or disable the dry-run mode. By default, it's enabled.
- You can use the `COMMIT` variable to enable or disable the commit creation. By default, it's disabled.
- To update the _Testcontainers for Go_ dependency for all the modules and examples, without performing any Git operation, nor creating a release:

DRY_RUN="false" ./scripts/release.sh
DRY_RUN="false" COMMIT="false" ./scripts/release.sh

- To perform a release:

DRY_RUN="false" COMMIT="true" ./scripts/release.sh

- The script will create a git tag with the current value of the [version.go](./internal/version.go) file, starting with `v`: e.g. `v0.18.0`, for the following Go modules:
- the root module, representing the Testcontainers for Go library.
Expand All @@ -23,8 +29,8 @@ Once the version file is correct in the repository:
BUMP_TYPE="major" ./scripts/release.sh

- The script will update the `go.mod` files for each Go modules and example modules under the examples and modules directories, updating the version of the testcontainers-go dependency to the recently created tag.
- The script will create a commit in the **main** branch.
- The script will push the git the main branch including the tags to the upstream repository, https://github.com/testcontainers/testcontainers-go
- The script will create a commit in the **main** branch if the `COMMIT` variable is set to `true`.
- The script will push the git the main branch including the tags to the upstream repository, https://github.com/testcontainers/testcontainers-go, if the `COMMIT` variable is set to `true`.

An example execution, with dry-run mode enabled:

Expand Down
2 changes: 1 addition & 1 deletion examples/bigtable/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
cloud.google.com/go/bigtable v1.18.1
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
google.golang.org/api v0.111.0
google.golang.org/grpc v1.53.0
gotest.tools/gotestsum v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion examples/cockroachdb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/google/uuid v1.3.0
github.com/jackc/pgx/v4 v4.18.1
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
2 changes: 1 addition & 1 deletion examples/consul/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/hashicorp/consul/api v1.19.1
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
2 changes: 1 addition & 1 deletion examples/datastore/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
cloud.google.com/go/datastore v1.10.0
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
google.golang.org/api v0.111.0
google.golang.org/grpc v1.53.0
gotest.tools/gotestsum v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion examples/firestore/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
cloud.google.com/go/firestore v1.9.0
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
google.golang.org/api v0.111.0
google.golang.org/grpc v1.53.0
gotest.tools/gotestsum v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion examples/mongodb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/examples/mongodb
go 1.19

require (
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
go.mongodb.org/mongo-driver v1.11.2
gotest.tools/gotestsum v1.9.0
)
Expand Down
2 changes: 1 addition & 1 deletion examples/mysql/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/go-sql-driver/mysql v1.7.0
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
2 changes: 1 addition & 1 deletion examples/nginx/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/examples/nginx
go 1.19

require (
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/docker/go-connections v0.4.0
github.com/lib/pq v1.10.7
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
2 changes: 1 addition & 1 deletion examples/pubsub/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
cloud.google.com/go/pubsub v1.28.0
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
google.golang.org/api v0.111.0
google.golang.org/grpc v1.53.0
gotest.tools/gotestsum v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion examples/redis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/go-redis/redis/v8 v8.11.5
github.com/google/uuid v1.3.0
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
2 changes: 1 addition & 1 deletion examples/spanner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
cloud.google.com/go/spanner v1.44.0
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
google.golang.org/api v0.111.0
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923
google.golang.org/grpc v1.53.0
Expand Down
2 changes: 1 addition & 1 deletion examples/toxiproxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/Shopify/toxiproxy/v2 v2.5.0
github.com/go-redis/redis/v8 v8.11.5
github.com/google/uuid v1.3.0
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ nav:
- Getting help: getting_help.md
edit_uri: edit/main/docs/
extra:
latest_version: v0.18.0
latest_version: v0.19.0
2 changes: 1 addition & 1 deletion modules/compose/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/docker/docker v23.0.1+incompatible
github.com/google/uuid v1.3.0
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
golang.org/x/sync v0.1.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/gotestsum v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion modules/localstack/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/docker/go-connections v0.4.0
github.com/imdario/mergo v0.3.13
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
golang.org/x/mod v0.9.0
gotest.tools/gotestsum v1.9.0
)
Expand Down
2 changes: 1 addition & 1 deletion modules/pulsar/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/docker/docker v23.0.1+incompatible
github.com/docker/go-connections v0.4.0
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go v0.18.0
github.com/testcontainers/testcontainers-go v0.19.0
gotest.tools/gotestsum v1.9.0
)

Expand Down
5 changes: 3 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Usage: DRY_RUN="false" ./scripts/release.sh

readonly DOCKER_IMAGE_SEMVER="docker.io/mdelapenya/semver-tool:3.4.0"
readonly COMMIT="${COMMIT:-false}"
readonly DRY_RUN="${DRY_RUN:-true}"
readonly CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
readonly ROOT_DIR="$(dirname "$CURRENT_DIR")"
Expand Down Expand Up @@ -111,7 +112,7 @@ function curlGolangProxy() {
local module_path="${1}"
local module_version="${2}"

if [[ "${DRY_RUN}" == "true" ]]; then
if [[ "${DRY_RUN}" == "true" || "${COMMIT}" == "false" ]]; then
echo "curl https://proxy.golang.org/${module_path}/@v/${module_version}"
return
fi
Expand All @@ -130,7 +131,7 @@ function extractCurrentVersion() {
# This function is used to run git commands
function gitFn() {
args=("$@")
if [[ "${DRY_RUN}" == "true" ]]; then
if [[ "${DRY_RUN}" == "true" || "${COMMIT}" == "false" ]]; then
echo "git ${args[@]}"
return
fi
Expand Down

0 comments on commit 2f49f6e

Please sign in to comment.