2022-09-14 03:42:38 +00:00
|
|
|
name: Test Docs Generation
|
|
|
|
|
2020-05-12 22:37:37 +00:00
|
|
|
on:
|
2022-09-14 03:42:38 +00:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
ref:
|
|
|
|
required: true
|
|
|
|
description: "GitHub ref to use"
|
|
|
|
type: string
|
|
|
|
pull_request_number:
|
|
|
|
required: true
|
|
|
|
description: "Pull request number"
|
|
|
|
type: string
|
|
|
|
pull_request_author:
|
|
|
|
required: true
|
|
|
|
description: "Pull request author, as a login name"
|
|
|
|
type: string
|
2020-05-12 22:37:37 +00:00
|
|
|
|
2020-10-09 16:35:12 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
|
2022-07-21 19:04:02 +00:00
|
|
|
DOTNET_ROLL_FORWARD: "Major"
|
2020-10-09 16:35:12 +00:00
|
|
|
|
2022-09-14 03:42:38 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2021-05-21 16:54:14 +00:00
|
|
|
|
2022-09-14 03:42:38 +00:00
|
|
|
jobs:
|
2023-02-02 17:30:07 +00:00
|
|
|
matrix:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-03-30 15:53:47 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-02 17:30:07 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.ref }}
|
|
|
|
- name: build matrix
|
|
|
|
id: matrix
|
|
|
|
run: |
|
|
|
|
echo "::group::Version set variable"
|
|
|
|
VERSION_SET=$(./scripts/get-job-matrix.py \
|
|
|
|
generate-version-set \
|
|
|
|
--version-set current
|
|
|
|
)
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Version set"
|
|
|
|
echo "$VERSION_SET" | yq -P '.'
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Set outputs"
|
|
|
|
./.github/scripts/set-output version-set "${VERSION_SET}"
|
|
|
|
echo "::endgroup::"
|
|
|
|
outputs:
|
|
|
|
version-set: "${{ fromJson(steps.matrix.outputs.version-set) }}"
|
|
|
|
|
2020-05-12 22:37:37 +00:00
|
|
|
aws:
|
|
|
|
name: Resource Docs
|
2023-02-02 17:30:07 +00:00
|
|
|
needs: [matrix]
|
2020-05-12 22:37:37 +00:00
|
|
|
# Verify that the event is not triggered by a fork since forks cannot
|
|
|
|
# access secrets other than the default GITHUB_TOKEN. Specifically,
|
2024-02-08 13:28:49 +00:00
|
|
|
# this workflow relies on the secret PULUMI_BOT_TOKEN to create a
|
2020-05-12 22:37:37 +00:00
|
|
|
# draft PR in the docs repo.
|
|
|
|
env:
|
|
|
|
GOPATH: ${{ github.workspace }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Install Go
|
2024-03-29 16:00:53 +00:00
|
|
|
uses: actions/setup-go@v5
|
2020-05-12 22:37:37 +00:00
|
|
|
with:
|
2023-02-02 17:30:07 +00:00
|
|
|
go-version: ${{ fromJson(needs.matrix.outputs.version-set).go }}
|
2020-05-12 22:37:37 +00:00
|
|
|
- name: Install Node.js
|
2024-03-29 18:03:41 +00:00
|
|
|
uses: actions/setup-node@v4
|
2020-05-12 22:37:37 +00:00
|
|
|
with:
|
2023-02-02 17:30:07 +00:00
|
|
|
node-version: ${{ fromJson(needs.matrix.outputs.version-set).nodejs }}
|
2022-09-14 03:42:38 +00:00
|
|
|
- name: Install Python
|
2024-03-29 16:10:15 +00:00
|
|
|
uses: actions/setup-python@v5
|
2022-09-14 03:42:38 +00:00
|
|
|
with:
|
2023-02-02 17:30:07 +00:00
|
|
|
python-version: ${{ fromJson(needs.matrix.outputs.version-set).python }}
|
2022-11-11 19:27:25 +00:00
|
|
|
- name: Set up DotNet
|
2024-02-20 12:20:04 +00:00
|
|
|
uses: actions/setup-dotnet@v4
|
2022-11-11 19:27:25 +00:00
|
|
|
with:
|
2023-02-02 17:30:07 +00:00
|
|
|
dotnet-version: ${{ fromJson(needs.matrix.outputs.version-set).dotnet }}
|
2022-11-11 19:27:25 +00:00
|
|
|
dotnet-quality: ga
|
2020-05-12 22:37:37 +00:00
|
|
|
- name: Install Pulumi CLI
|
2020-11-17 01:05:28 +00:00
|
|
|
uses: pulumi/action-install-pulumi-cli@v1.0.1
|
2020-05-12 22:37:37 +00:00
|
|
|
- name: Check out source code
|
2024-03-30 15:53:47 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-05-12 22:37:37 +00:00
|
|
|
with:
|
|
|
|
path: pulumi
|
2022-09-14 03:42:38 +00:00
|
|
|
ref: ${{ inputs.ref }}
|
2024-02-08 13:28:49 +00:00
|
|
|
token: ${{ secrets.PULUMI_BOT_TOKEN }}
|
2020-05-12 22:37:37 +00:00
|
|
|
- name: Check out pulumi-aws
|
2024-03-30 15:53:47 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-05-12 22:37:37 +00:00
|
|
|
with:
|
|
|
|
repository: pulumi/pulumi-aws
|
|
|
|
path: pulumi-aws
|
2024-02-08 13:28:49 +00:00
|
|
|
token: ${{ secrets.PULUMI_BOT_TOKEN }}
|
2020-05-12 22:37:37 +00:00
|
|
|
- name: Check out pulumi-kubernetes
|
2024-03-30 15:53:47 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-05-12 22:37:37 +00:00
|
|
|
with:
|
|
|
|
repository: pulumi/pulumi-kubernetes
|
|
|
|
path: pulumi-kubernetes
|
2024-02-08 13:28:49 +00:00
|
|
|
token: ${{ secrets.PULUMI_BOT_TOKEN }}
|
2020-05-12 22:37:37 +00:00
|
|
|
- name: Check out docs
|
2024-03-30 15:53:47 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-05-12 22:37:37 +00:00
|
|
|
with:
|
|
|
|
# Use the PAT and not the default GITHUB_TOKEN since we want to create a branch
|
|
|
|
# in this workflow and push it to a remote that is NOT the current repo, i.e. pulumi/pulumi.
|
2024-02-08 13:28:49 +00:00
|
|
|
token: ${{ secrets.PULUMI_BOT_TOKEN }}
|
2020-05-12 22:37:37 +00:00
|
|
|
repository: pulumi/docs
|
|
|
|
path: docs
|
2024-02-08 13:28:49 +00:00
|
|
|
- name: Check out registry
|
2024-03-30 15:53:47 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-02-08 13:28:49 +00:00
|
|
|
with:
|
|
|
|
repository: pulumi/registry
|
|
|
|
path: registry
|
|
|
|
|
2020-05-12 22:37:37 +00:00
|
|
|
|
|
|
|
- name: Regenerate resource docs
|
|
|
|
id: regenerate-resource-docs
|
|
|
|
run: |
|
|
|
|
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
|
|
|
|
BRANCH_NAME="${GITHUB_ACTOR}/${PR_NUMBER}-test-generator-changes"
|
|
|
|
|
2024-02-08 13:28:49 +00:00
|
|
|
pushd registry/tools/resourcedocsgen
|
2021-11-10 19:07:43 +00:00
|
|
|
|
|
|
|
go mod edit -replace github.com/pulumi/pulumi/pkg/v3=../../../pulumi/pkg
|
|
|
|
go mod edit -replace github.com/pulumi/pulumi/sdk/v3=../../../pulumi/sdk
|
2024-02-08 13:28:49 +00:00
|
|
|
|
|
|
|
go mod tidy
|
|
|
|
|
|
|
|
if [ -z "${GOPATH:-}" ]; then
|
|
|
|
echo "GOPATH is empty. Defaulting to ${HOME}/go"
|
|
|
|
GOPATH="${HOME}/go"
|
|
|
|
fi
|
|
|
|
go build -o "${GOPATH}/bin/resourcedocsgen" .
|
|
|
|
export PATH="${GOPATH}/bin/":$PATH
|
|
|
|
|
2021-11-10 19:07:43 +00:00
|
|
|
popd
|
|
|
|
|
2024-02-08 13:28:49 +00:00
|
|
|
# If generating docs for more providers here, be sure to update
|
|
|
|
# the description of the draft PR that is opened in the next step.
|
|
|
|
pushd docs
|
|
|
|
|
2023-08-11 15:33:08 +00:00
|
|
|
./scripts/gen_resource_docs.sh aws true v5.42.0
|
2020-05-12 22:37:37 +00:00
|
|
|
./scripts/gen_resource_docs.sh kubernetes true
|
2021-11-18 20:23:30 +00:00
|
|
|
|
2020-05-12 22:37:37 +00:00
|
|
|
popd
|
|
|
|
|
2023-02-18 13:55:39 +00:00
|
|
|
echo "branchName=${BRANCH_NAME}" >> "${GITHUB_OUTPUT}"
|
|
|
|
echo "prNumber=${PR_NUMBER}" >> "${GITHUB_OUTPUT}"
|
2020-05-12 22:37:37 +00:00
|
|
|
|
|
|
|
- name: Create draft docs PR
|
2020-12-08 23:30:05 +00:00
|
|
|
uses: peter-evans/create-pull-request@v3
|
2020-05-12 22:37:37 +00:00
|
|
|
with:
|
|
|
|
draft: true
|
|
|
|
# We use a repo:public scoped PAT instead of the implicitly provided GITHUB_TOKEN secret here
|
|
|
|
# because we want the creation of the docs PR to trigger the `on: pull_request` workflow in the
|
|
|
|
# docs repo. Using a fork repo to raise the PR would also cause the `on: pull_request` workflow
|
|
|
|
# to trigger, but currently Pulumify in the docs repo does not run for forks, but we want it to
|
|
|
|
# generate the preview link.
|
2024-02-08 13:28:49 +00:00
|
|
|
token: ${{ secrets.PULUMI_BOT_TOKEN }}
|
2020-05-12 22:37:37 +00:00
|
|
|
path: docs
|
|
|
|
committer: Pulumi Bot <bot@pulumi.com>
|
|
|
|
author: Pulumi Bot <bot@pulumi.com>
|
|
|
|
commit-message: Regenerate resource docs
|
2020-05-16 00:33:56 +00:00
|
|
|
title: Preview resource docs changes for pulumi/pulumi#${{ steps.regenerate-resource-docs.outputs.prNumber }}
|
2020-05-12 22:37:37 +00:00
|
|
|
body: |
|
|
|
|
This PR was auto-generated from pulumi/pulumi#${{ steps.regenerate-resource-docs.outputs.prNumber }}.
|
2020-05-16 00:33:56 +00:00
|
|
|
By default, this PR contains regenerated docs for AWS and Kubernetes only.
|
2022-04-19 22:39:13 +00:00
|
|
|
After review, this PR should be manually closed.
|
2020-05-16 00:33:56 +00:00
|
|
|
# Assign the draft PR to the author of the current PR.
|
2022-09-14 03:42:38 +00:00
|
|
|
assignees: ${{ inputs.pull_request_author }}
|
2020-05-12 22:37:37 +00:00
|
|
|
branch: ${{ steps.regenerate-resource-docs.outputs.branchName }}
|