-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: publish a top-level README in Go repositories
- Loading branch information
Showing
2 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,10 @@ export class CdktfProviderProject extends cdk.JsiiProject { | |
const mavenName = `com.${mavenOrg}.${namespace}.providers.${getMavenName( | ||
providerName | ||
)}`; | ||
const repositoryUrl = `github.com/${githubNamespace}/${namespace}-provider-${providerName.replace( | ||
/-/g, | ||
"" | ||
)}`; | ||
|
||
const packageInfo: PackageInfo = { | ||
npm: { | ||
|
@@ -138,10 +142,7 @@ export class CdktfProviderProject extends cdk.JsiiProject { | |
mavenEndpoint, | ||
}, | ||
publishToGo: { | ||
moduleName: `github.com/${githubNamespace}/${namespace}-provider-${providerName.replace( | ||
/-/g, | ||
"" | ||
)}-go`, | ||
moduleName: `${repositoryUrl}-go`, | ||
gitUserEmail: "[email protected]", | ||
gitUserName: "CDK for Terraform Team", | ||
packageName: providerName.replace(/-/g, ""), | ||
|
@@ -176,6 +177,25 @@ export class CdktfProviderProject extends cdk.JsiiProject { | |
name: "Remove copywrite hcl file", | ||
run: "rm -f .repo/dist/go/.copywrite.hcl", | ||
}, | ||
{ | ||
name: "Move the README file up a directory", | ||
run: "mv .repo/dist/go/*/README.md .repo/dist/go/README.md", | ||
continueOnError: true, // can be removed later once confirmed this works | ||
}, | ||
{ | ||
name: "Remove some text from the README that doesn't apply to Go", | ||
run: [ | ||
"sed -i 's/# CDKTF prebuilt bindings for/# CDKTF Go bindings for/' .repo/dist/go/README.md", | ||
// @see https://stackoverflow.com/a/49511949 | ||
"sed -i -e '/## Available Packages/,/### Go/!b' -e '/### Go/!d;p; s/### Go/## Go Package/' -e 'd' .repo/dist/go/README.md", | ||
// sed -e is black magic and for whatever reason the string replace doesn't work so let's try it again: | ||
"sed -i 's/### Go/## Go Package/' .repo/dist/go/README.md", | ||
// Just straight up delete these full lines and everything in between them: | ||
"sed -i -e '/API.typescript.md/,/You can also visit a hosted version/!b' -e 'd' dist/go/README.md", | ||
`sed -i 's|Find auto-generated docs for this provider here:|Find auto-generated docs for this provider [here](https://${repositoryUrl}/blob/main/docs/API.go.md).|' .repo/dist/go/README.md`, | ||
].join("\n"), | ||
continueOnError: true, // can be removed later once confirmed this works | ||
}, | ||
{ | ||
name: "Collect go Artifact", | ||
run: "mv .repo/dist dist", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.