Skip to content

Commit

Permalink
chore: copy the README in the Go repo instead of moving it
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehan committed Dec 13, 2023
1 parent 1b9c394 commit baed017
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 70 deletions.
23 changes: 12 additions & 11 deletions src/force-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,25 @@ export class ForceRelease {
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",
"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 -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",
"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' .repo/dist/go/*/README.md",
`sed -i 's|Find auto-generated docs for this provider here:|Find auto-generated docs for this provider [here](https://${options.repositoryUrl}/blob/main/docs/API.go.md).|' .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' .repo/dist/go/README.md",
`sed -i 's|Find auto-generated docs for this provider here:|Find auto-generated docs for this provider [here](https://${options.repositoryUrl}/blob/main/docs/API.go.md).|' .repo/dist/go/README.md`,
"sed -i -e '/### Provider Version/,/The provider version can be adjusted/!b' -e 'd' .repo/dist/go/*/README.md",
].join("\n"),
continueOnError: true, // can be removed later once confirmed this works
continueOnError: true,
},
{
name: "Copy the README file to the parent directory",
run: "cp .repo/dist/go/*/README.md .repo/dist/go/README.md",
},
{
name: "Collect go Artifact",
Expand Down
23 changes: 12 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,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",
"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 -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",
"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' .repo/dist/go/*/README.md",
`sed -i 's|Find auto-generated docs for this provider here:|Find auto-generated docs for this provider [here](https://${options.repositoryUrl}/blob/main/docs/API.go.md).|' .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' .repo/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`,
"sed -i -e '/### Provider Version/,/The provider version can be adjusted/!b' -e 'd' .repo/dist/go/*/README.md",
].join("\n"),
continueOnError: true, // can be removed later once confirmed this works
continueOnError: true,
},
{
name: "Copy the README file to the parent directory",
run: "cp .repo/dist/go/*/README.md .repo/dist/go/README.md",
},
{
name: "Collect go Artifact",
Expand Down
96 changes: 48 additions & 48 deletions test/__snapshots__/index.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit baed017

Please sign in to comment.