diff --git a/.github/workflows/publish-docs.yaml b/.github/workflows/publish-docs.yaml new file mode 100644 index 0000000..1dbdc7c --- /dev/null +++ b/.github/workflows/publish-docs.yaml @@ -0,0 +1,51 @@ +# Reusable workflow: Publish connector docs to registry on release. +# BLOCKED: Registry deployment required before activation. +name: Publish Connector Docs + +on: + workflow_call: + inputs: + tag: + required: true + type: string + description: "Release tag (semver)" + secrets: + RELENG_GITHUB_TOKEN: + required: true + # TODO: Add registry API authentication secret when deployed + REGISTRY_API_TOKEN: + required: true + +jobs: + publish-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout connector repo + uses: actions/checkout@v5 + with: + repository: ${{ github.event.repository.full_name }} + ref: ${{ inputs.tag }} + + - name: Check for connector docs + id: check-docs + run: | + if [ -f docs/connector.mdx ]; then + echo "has_docs=true" >> "$GITHUB_OUTPUT" + else + echo "has_docs=false" >> "$GITHUB_OUTPUT" + echo "::notice::No docs/connector.mdx found. Skipping doc publishing." + fi + + - name: Publish docs to registry + if: steps.check-docs.outputs.has_docs == 'true' + env: + CONNECTOR_NAME: ${{ github.event.repository.name }} + TAG: ${{ inputs.tag }} + # TODO: Set REGISTRY_API_URL when registry is deployed + # REGISTRY_API_URL: https://registry-api.conductorone.com + run: | + # TODO: Set REGISTRY_API_URL when registry is deployed + curl -X POST "${REGISTRY_API_URL}/v1/connectors/${CONNECTOR_NAME}/versions/${TAG}/docs" \ + -H "Authorization: Bearer ${REGISTRY_API_TOKEN}" \ + -H "Content-Type: application/json" \ + -d @<(jq -n --arg doc "$(cat docs/connector.mdx)" '{"documentation": $doc}') diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bbd5173..f5b8899 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -823,6 +823,16 @@ jobs: run: | ./scripts/validate-release-artifacts.sh "$ORG_REPO" "$VERSION" + # TODO: Activate when registry is deployed. Currently scaffolded only. + publish-docs: + needs: [record-connector-registry] + if: always() && needs.record-connector-registry.result == 'success' + uses: ConductorOne/github-workflows/.github/workflows/publish-docs.yaml@main + with: + tag: ${{ inputs.tag }} + secrets: + RELENG_GITHUB_TOKEN: ${{ secrets.RELENG_GITHUB_TOKEN }} + notify-release-failure: needs: [