diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a6270ac..0a37cd5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -92,3 +92,52 @@ jobs: uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: packages-dir: release/dist/ + + docs: + needs: publish + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + concurrency: + group: reflag-docs-sync + cancel-in-progress: false + env: + RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: refs/tags/${{ env.RELEASE_TAG }} + fetch-depth: 0 + persist-credentials: false + path: sdk + - name: Checkout docs + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: reflagcom/docs + ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }} + path: reflag-docs + - uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0 + with: + node-version: 24 + - name: Copy the released README into the docs + run: node reflag-docs/.github/scripts/sdk-readme.mjs sync --sdk python-sdk --source sdk --destination reflag-docs + - name: Check docs + working-directory: reflag-docs + run: node .github/scripts/check-sdk-docs.mjs + - name: Commit and push + working-directory: reflag-docs + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@reflag.com" + git add supported-languages .generated/sdk-readmes + if git diff --cached --quiet; then + echo "Docs already match $RELEASE_TAG." + exit 0 + fi + git commit -m "Update Python SDK documentation to $RELEASE_TAG" + for attempt in 1 2 3; do + git push && exit 0 + git pull --rebase + done + exit 1