Skip to content

Commit

Permalink
Migrate to full use of tools/resourcedocsgen (#4663)
Browse files Browse the repository at this point in the history
* Migrate registrygen's metadata command to tools/resourcedocsgen

* Ignore the build resourcedocsgen binary

* Special-case Pulumi for top-level config files not found

* Update Go module name and update references

* Use resourcedocsgen for generating package metadata
Update README reference

* Transport pkgversion check to resourcedocsgen

* Replace pkgversion check

* Update tools/resourcedocsgen/cmd/metadata.go

Co-authored-by: Ian Wahbe <[email protected]>

* package is a reserved word

* Fix command verbiage

* Do not commit binary file

---------

Co-authored-by: Ian Wahbe <[email protected]>
  • Loading branch information
guineveresaenger and iwahbe authored Jun 5, 2024
1 parent de84037 commit 86756fd
Show file tree
Hide file tree
Showing 15 changed files with 613 additions and 255 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/generate-package-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,25 @@ jobs:
- name: Sleep to prevent hitting secondary rate limits
if: steps.skip-run.outputs.skip != 1
run: sleep 1
- name: Install Registrygen CLI
if: steps.skip-run.outputs.skip != 1
uses: jaxxstorm/[email protected]
with:
repo: pulumi/registrygen
- name: Check for a new version
if: steps.skip-run.outputs.skip != 1
id: version
run: |
echo 'PROVIDER_VERSION<<EOF' >> $GITHUB_ENV
registrygen pkgversion --repoSlug ${{ matrix.repoSlug }} \
cd tools/resourcedocsgen && \
go run github.com/pulumi/registry/tools/resourcedocsgen pkgversion --repoSlug ${{ matrix.repoSlug }} \
>> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# This will only be populated if the registry version does not match the latest provider version.
- name: Display new version
if: env.PROVIDER_VERSION
run: echo ${{ env.PROVIDER_VERSION}}
# We only need to run the following steps if registrygen found a newer version of the community provider.
# We only need to run the following steps if resourcedocsgen found a newer version of the community provider.
- name: Generate Package Metadata
if: env.PROVIDER_VERSION
run: |
registrygen metadata --repoSlug ${{ matrix.repoSlug }} --schemaFile ${{ matrix.schemaFile }} \
cd tools/resourcedocsgen && go run github.com/pulumi/registry/tools/resourcedocsgen \
metadata --repoSlug ${{ matrix.repoSlug }} --schemaFile ${{ matrix.schemaFile }} \
--version ${{ env.PROVIDER_VERSION }}
- name: Create registry PR
if: env.PROVIDER_VERSION
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/publish-provider-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ jobs:
- run: echo "Building ${{ env.PROVIDER_NAME }} docs @ ${{ env.PROVIDER_VERSION }}"
- name: checkout registry repo
uses: actions/checkout@v2
- name: Install Registrygen CLI
uses: jaxxstorm/[email protected]
with:
repo: pulumi/registrygen
- name: Generate Package Metadata
run: |
registrygen metadata --providerName=${{ env.PROVIDER_SHORT_NAME }} --repoSlug pulumi/pulumi-${{ env.PROVIDER_SHORT_NAME }} --schemaFile="${{ env.PROVIDER_SCHEMA_PATH }}" --version="${{ env.PROVIDER_VERSION }}" --publisher Pulumi
cd tools/resourcedocsgen && go run github.com/pulumi/registry/tools/resourcedocsgen \
metadata --providerName=${{ env.PROVIDER_SHORT_NAME }} --repoSlug pulumi/pulumi-${{ env.PROVIDER_SHORT_NAME }} --schemaFile="${{ env.PROVIDER_SCHEMA_PATH }}" --version="${{ env.PROVIDER_VERSION }}" --publisher Pulumi
- name: git status
run: git status && git diff
- name: Create registry PR
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ public
.vscode
cypress/videos
cypress/screenshots
tools/resourcedocsgen/resourcedocsgen
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ cp ../docs/content/registry/packages/aws/how-to-guides ./themes/default/content/

#### Generating API docs for packages

The API docs for packages can be generated on-demand using the [`registrygen` tool](https://github.com/pulumi/registrygen).
The API docs for packages can be generated on-demand using the [`resourcedocsgen` tool](tools/resourcedocsgen/README.md).

```
go install github.com/pulumi/registrygen@master
cd tools/resourcedocsgen
go build -o "${GOPATH}/bin/resourcedocsgen" .
```

Run `registrygen --help` for help regarding its use or [see the `registrygen` README](https://github.com/pulumi/registrygen#readme).
Run `resourcedocsgen --help` for help regarding its use or [see the `resourcedocsgen` README](tools/resourcedocsgen/README.md).

## Submitting, merging and releasing

Expand Down
2 changes: 1 addition & 1 deletion tools/resourcedocsgen/cmd/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/golang/glog"
"github.com/hashicorp/hcl/v2"
"github.com/pkg/errors"
"github.com/pulumi/docs/tools/resourcedocsgen/pkg"
"github.com/pulumi/registry/tools/resourcedocsgen/pkg"
"github.com/spf13/cobra"

docsgen "github.com/pulumi/pulumi/pkg/v3/codegen/docs"
Expand Down
2 changes: 1 addition & 1 deletion tools/resourcedocsgen/cmd/docs/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (

"github.com/pkg/errors"

"github.com/pulumi/docs/tools/resourcedocsgen/pkg"
pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"github.com/pulumi/registry/tools/resourcedocsgen/pkg"
)

func getRepoSlug(repoURL string) (string, error) {
Expand Down
Loading

0 comments on commit 86756fd

Please sign in to comment.