Skip to content

Commit 6e01b02

Browse files
committed
fix(build): update paths for Dart client generation and improve Git command execution
1 parent 0d17328 commit 6e01b02

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

build.gradle.kts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,18 @@ tasks {
9898
register("pushDartClient") {
9999
dependsOn("openApiGenerate")
100100
doLast {
101-
val clientDir = file("$buildDir/generated/dart-client")
101+
val clientDir = file("$projectDir/build/generated/dart-client")
102102
val version = project.version as String
103103

104104
// Get GitHub credentials from environment variables
105105
val githubToken = System.getenv("CLIENT_REPO_TOKEN") ?: System.getenv("GITHUB_TOKEN") ?: throw GradleException("CLIENT_REPO_TOKEN or GITHUB_TOKEN environment variable is required")
106106

107107
// Create a temporary directory for the Git repository
108-
val tempDir = file("$buildDir/temp/vulpes-client")
108+
val tempDir = file("$projectDir/build/temp/vulpes-client")
109109
tempDir.mkdirs()
110110

111-
// Configure Git user
112-
exec {
113-
commandLine("git", "config", "--global", "user.name", "GitHub Actions")
114-
}
115-
116-
exec {
117-
commandLine("git", "config", "--global", "user.email", "[email protected]")
118-
}
119-
120111
// Clone the repository using token authentication
121-
exec {
112+
providers.exec {
122113
workingDir = tempDir
123114
commandLine("git", "clone", "https://${githubToken}@github.com/OneLiteFeatherNET/vulpes-backend-client-dart.git", ".")
124115
}
@@ -130,22 +121,22 @@ tasks {
130121
}
131122

132123
// Commit and push the changes
133-
exec {
124+
providers.exec {
134125
workingDir = tempDir
135126
commandLine("git", "add", ".")
136127
}
137128

138-
exec {
129+
providers.exec {
139130
workingDir = tempDir
140131
commandLine("git", "commit", "-m", "Update client to version $version")
141132
}
142133

143-
exec {
134+
providers.exec {
144135
workingDir = tempDir
145136
commandLine("git", "tag", "-a", "v$version", "-m", "Version $version")
146137
}
147138

148-
exec {
139+
providers.exec {
149140
workingDir = tempDir
150141
commandLine("git", "push", "origin", "main", "--tags")
151142
}

0 commit comments

Comments
 (0)