Auto generate and publish CLI docs on each release #885
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Continuous Integration | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Get user info from GitHub API | |
| id: get_user | |
| run: | | |
| echo "GitHub actor: ${{ github.actor }}" | |
| # Query the GitHub API for the user's details. | |
| curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| https://api.github.com/users/${{ github.actor }} > user.json | |
| # Extract the user's full name if available, default to the username otherwise. | |
| git_name=$(jq -r '.name // empty' user.json) | |
| if [ -z "$git_name" ]; then | |
| git_name="${{ github.actor }}" | |
| fi | |
| git_email="${{ github.actor }}@users.noreply.github.com" | |
| # Set the outputs for subsequent steps. | |
| echo "git_name=$git_name" >> $GITHUB_OUTPUT | |
| echo "git_email=$git_email" >> $GITHUB_OUTPUT | |
| - name: Generate token | |
| id: generate_token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }} | |
| private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }} | |
| # TODO: mention CLI release version | |
| # TODO: change this to main once docs side PR lands in main | |
| - name: Trigger Documentation Workflow | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
| run: | | |
| gh workflow run update-cli-docs.yml \ | |
| -R temporalio/documentation \ | |
| --ref cli-docs-autoupdate \ | |
| -f cli_branch="${{ github.ref_name }}" \ | |
| -f commit_author="${{ steps.get_user.outputs.git_name }}" \ | |
| -f commit_author_email="${{ steps.get_user.outputs.git_email }}" \ | |
| -f commit_message="Update CLI docs for release ${{ github.release.tag_name }}" |