Skip to content

Commit

Permalink
Fix version replacement (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
vigoo authored Apr 18, 2024
1 parent 79d9423 commit 7f9f18b
Showing 1 changed file with 12 additions and 107 deletions.
119 changes: 12 additions & 107 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ description = """This is the top-level task that builds everything in release mo
to build for other target than the current one, can be linux/amd64 or linux/arm64. This is used for cross-compiling
for docker images."""
dependencies = [
"set-golem-template-service-version",
"set-golem-worker-service-version",
"set-golem-worker-executor-version",
"set-golem-shard-manager-version",
"set-golem-api-grpc-version",
"set-golem-common-version",
"set-golem-test-framework-version",
"set-version",
"build-release-default",
"build-release-override-linux-amd64",
"build-release-override-linux-arm64"
Expand All @@ -64,9 +58,6 @@ dependencies = [
[tasks.build-release-default]
description = "Build the project in release mode"
condition = { env_not_set = ["PLATFORM_OVERRIDE"] }
dependencies = [
"set-golem-client-version", "set-golem-cli-version", # these need to be set before the build for publishing
]
command = "cargo"
args = ["build", "--release"]

Expand Down Expand Up @@ -246,70 +237,28 @@ dependencies = [
"publish-golem-cli"
]

[tasks.set-golem-client-version]
description = "Sets the version in golem-client/Cargo.toml to the value of the VERSION environment variable"
[tasks.set-version]
description = "Sets the version in all Cargo.toml files to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-client/Cargo.toml"]
script = '''
grep -rl --include '.*Cargo\.toml' '0\.0\.0' | xargs sed -i "s/0\.0\.0/${VERSION}/g"
'''

[tasks.set-golem-client-version.mac]
[tasks.set-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-client/Cargo.toml"]
script = '''
grep -rl --include '.*Cargo\.toml' '0\.0\.0' | xargs sed -i "" "s/0\.0\.0/${VERSION}/g"
'''

[tasks.publish-golem-client]
description = "Publishes golem-client package to crates.io"
dependencies = ["set-golem-client-version", "set-golem-cli-version", "build-release"]
dependencies = ["build-release"]
command = "cargo"
args = ["publish", "-p", "golem-client", "--all-features", "--allow-dirty"]

[tasks.set-golem-cli-version]
description = "Sets the version in golem-cli/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-cli/Cargo.toml"]

[tasks.set-golem-cli-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-cli/Cargo.toml"]

[tasks.set-golem-test-framework-version]
description = "Sets the version in golem-test-framework/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-test-framework/Cargo.toml"]

[tasks.set-golem-test-framework-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-test-framework/Cargo.toml"]

[tasks.set-golem-common-version]
description = "Sets the version in golem-common/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-common/Cargo.toml"]

[tasks.set-golem-common-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-common/Cargo.toml"]

[tasks.set-golem-api-grpc-version]
description = "Sets the version in golem-api-grpc/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-api-grpc/Cargo.toml"]

[tasks.set-golem-api-grpc-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-api-grpc/Cargo.toml"]

[tasks.publish-golem-cli]
description = "Publishes golem-cli package to crates.io"
dependencies = ["set-golem-cli-version", "set-golem-client-version", "build-release"]
dependencies = ["build-release"]
command = "cargo"
args = ["publish", "-p", "golem-cli", "--all-features", "--allow-dirty"]

Expand Down Expand Up @@ -363,47 +312,3 @@ env = { "PLATFORM_TARGET" = "aarch64-unknown-linux-gnu" }
extend = "package-release-base"
dependencies = ["build-release-override-linux-arm64"]


[tasks.set-golem-template-service-version]
description = "Sets the version in golem-template-service/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-template-service/Cargo.toml"]

[tasks.set-golem-template-service-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-template-service/Cargo.toml"]

[tasks.set-golem-worker-service-version]
description = "Sets the version in golem-worker-service/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-service/Cargo.toml"]

[tasks.set-golem-worker-service-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-service/Cargo.toml"]

[tasks.set-golem-worker-executor-version]
description = "Sets the version in golem-worker-executor/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-executor/Cargo.toml"]

[tasks.set-golem-worker-executor-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-executor/Cargo.toml"]

[tasks.set-golem-shard-manager-version]
description = "Sets the version in golem-shard-manager/Cargo.toml to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-shard-manager/Cargo.toml"]

[tasks.set-golem-shard-manager-version.mac]
condition = { env_set = ["VERSION"] }
command = "sed"
args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-shard-manager/Cargo.toml"]

0 comments on commit 7f9f18b

Please sign in to comment.