Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to publish family provider docs for provider-updoc workflow #134

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions .github/workflows/provider-updoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ name: Updoc

on:
workflow_call:
inputs:
providers:
description: 'Family provider names for which to publish the docs, e.g., "monolith config". The provider names should be space-delimited.'
default: 'monolith'
required: false
type: string
secrets:
UPBOUND_CI_PROD_BUCKET_SA:
required: true

env:
GO_VERSION: '1.19'
UPTEST_VERSION: '83bd901'
GO_VERSION: "1.19"
UPTEST_VERSION: "83bd901"

jobs:
publish-docs:
Expand Down Expand Up @@ -53,10 +59,22 @@ jobs:
GOOGLE_APPLICATION_CREDENTIALS: sa.json
PROVIDER_NAME: ${GITHUB_REPOSITORY#*/}
VER_MAJOR_MINOR: v${GITHUB_REF#"refs/heads/release-"}
SUBPACKAGES: ${{ inputs.providers }}
run: |
if [[ "${GITHUB_REF##*/}" == release-* ]]; then
echo "Publishing Docs for ${{ env.PROVIDER_NAME }}, ${{ env.VER_MAJOR_MINOR }}"
go run github.com/upbound/uptest/cmd/updoc@${{ env.UPTEST_VERSION }} upload --docs-dir=./docs --name=${{ env.PROVIDER_NAME }} --version=${{ env.VER_MAJOR_MINOR }} --bucket-name=bucket-marketplace-docs-production --cdn-domain=https://user-content.upbound.io
for s in $SUBPACKAGES; do
PROVIDER_PACKAGE_NAME="${{ env.PROVIDER_NAME }}-$s"
DOCS_DIR="./docs/family"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: In a future iteration, we may rename the docs/family folders in the official provider repositories as docs/config because config is the name that we use internally for referring to the family's config package. This would further allow us to compute the docs folder from which to publish the docs as follows:

DOCS_DIR="./docs/${s}"

This would also eliminate the conditionals in this block. It would also make it easy for us to publish specific docs for new resource providers (if this is needed in the future).

if [ $s == 'monolith' ]; then
PROVIDER_PACKAGE_NAME="${{ env.PROVIDER_NAME }}"
DOCS_DIR="./docs/monolith"
turkenf marked this conversation as resolved.
Show resolved Hide resolved
elif [ $s == 'config' ]; then
PROVIDER_PACKAGE_NAME="provider-family-${GITHUB_REPOSITORY#*-}"
DOCS_DIR="./docs/family"
fi
echo "Publishing Docs for $PROVIDER_PACKAGE_NAME, ${{ env.VER_MAJOR_MINOR }} from $DOCS_DIR"
go run github.com/upbound/uptest/cmd/updoc@${{ env.UPTEST_VERSION }} upload --docs-dir=“${DOCS_DIR}” --name=“${PROVIDER_PACKAGE_NAME}” --version=${{ env.VER_MAJOR_MINOR }} --bucket-name=bucket-marketplace-docs-production --cdn-domain=https://user-content.upbound.io
done
else
echo "This job can only be run on release branches"
exit 1
Expand Down
Loading