From 9e5119f9c39cd2a2ed1654726daf1c4e1638daf0 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 19:18:59 -0800 Subject: [PATCH 01/21] new update-docs.yml pipeline to auto-publish PRs --- .github/workflows/update-docs.yml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/update-docs.yml diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml new file mode 100644 index 000000000..0c68a0e15 --- /dev/null +++ b/.github/workflows/update-docs.yml @@ -0,0 +1,49 @@ +name: Update Documentation repository +on: + workflow_dispatch: + release: + types: [published] +jobs: + update: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + path: cli + + - name: Checkout tools repo + uses: actions/checkout@v4 + with: + repository: temporalio/documentation + path: docs + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.22' + + - name: Generate CLI docs + run: go run ./cli/temporalcli/internal/cmd/gen-docs + + - name: Copy files over and generate PR + run: | + BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" + + cd docs + git checkout -b $BRANCH_NAME + cp ../cli/temporalcli/docs/*.mdx docs/cli/ + git add . + git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" + git push origin $BRANCH_NAME + + gh pr create \ + --body "Autogenerated PR from https://github.com/temporalio/cli" \ + --title "CLI docs update $LATEST_TAG" \ + --head "$BRANCH_NAME" \ + --base "main" From bd65701fcaf1e46dcdf3d2f52427e7d461fb7f41 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 19:24:03 -0800 Subject: [PATCH 02/21] Use the ci pipeline to test new pipeline changes --- .github/workflows/ci.yaml | 88 +++++++++++++++------------------------ 1 file changed, 34 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99e577925..0196d2f0d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,69 +1,49 @@ name: Continuous Integration on: - pull_request: - push: - branches: - - main - + workflow_dispatch: + release: + types: [published] jobs: - build-test: - strategy: - fail-fast: true - matrix: - os: [ubuntu-latest, macos-latest, macos-14, windows-latest, ubuntu-arm] - include: - - os: ubuntu-latest - checkGenCodeTarget: true - cloudTestTarget: true - - os: ubuntu-arm - runsOn: buildjet-4vcpu-ubuntu-2204-arm - runs-on: ${{ matrix.runsOn || matrix.os }} + update: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + steps: - name: Checkout repository uses: actions/checkout@v2 with: - submodules: recursive + path: cli + + - name: Checkout tools repo + uses: actions/checkout@v4 + with: + repository: temporalio/documentation + path: docs - name: Setup Go uses: actions/setup-go@v4 with: go-version: '1.22' - - name: Install gotestsum - run: go install gotest.tools/gotestsum@latest - - - name: Create junit-xml directory - run: mkdir junit-xml + - name: Generate CLI docs + run: go run ./cli/temporalcli/internal/cmd/gen-docs - - name: Test - run: gotestsum --junitfile junit-xml/${{matrix.os}}.xml -- ./... - - - name: 'Upload junit-xml artifacts' - uses: actions/upload-artifact@v4 - if: always() - with: - name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--${{matrix.os}} - path: junit-xml - retention-days: 14 - - - name: Regen code, confirm unchanged - if: ${{ matrix.checkGenCodeTarget }} - run: | - go run ./temporalcli/internal/cmd/gen-commands - git diff --exit-code - - - name: Test cloud - # Only supported in non-fork runs, since secrets are not available in forks - if: ${{ matrix.cloudTestTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/cli') }} - env: - TEMPORAL_ADDRESS: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233 - TEMPORAL_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }} - TEMPORAL_TLS_CERT: client.crt - TEMPORAL_TLS_CERT_CONTENT: ${{ secrets.TEMPORAL_CLIENT_CERT }} - TEMPORAL_TLS_KEY: client.key - TEMPORAL_TLS_KEY_CONTENT: ${{ secrets.TEMPORAL_CLIENT_KEY }} - shell: bash + - name: Copy files over and generate PR run: | - printf '%s\n' "$TEMPORAL_TLS_CERT_CONTENT" >> client.crt - printf '%s\n' "$TEMPORAL_TLS_KEY_CONTENT" >> client.key - go run ./cmd/temporal workflow list --limit 2 + BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" + + cd docs + git checkout -b $BRANCH_NAME + cp ../cli/temporalcli/docs/*.mdx docs/cli/ + git add . + git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" + git push origin $BRANCH_NAME + + gh pr create \ + --body "Autogenerated PR from https://github.com/temporalio/cli" \ + --title "CLI docs update $LATEST_TAG" \ + --head "$BRANCH_NAME" \ + --base "main" From d9bf7f9b80d37b1710c1c752aeb78ae11d8fe97d Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 19:43:08 -0800 Subject: [PATCH 03/21] Use the trigger-publish pipeline to test new pipeline changes --- .github/workflows/ci.yaml | 88 ++++++++++++++++----------- .github/workflows/trigger-publish.yml | 53 ++++++++++------ 2 files changed, 87 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0196d2f0d..99e577925 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,49 +1,69 @@ name: Continuous Integration on: - workflow_dispatch: - release: - types: [published] -jobs: - update: - runs-on: ubuntu-latest - - defaults: - run: - shell: bash + pull_request: + push: + branches: + - main +jobs: + build-test: + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, macos-latest, macos-14, windows-latest, ubuntu-arm] + include: + - os: ubuntu-latest + checkGenCodeTarget: true + cloudTestTarget: true + - os: ubuntu-arm + runsOn: buildjet-4vcpu-ubuntu-2204-arm + runs-on: ${{ matrix.runsOn || matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v2 with: - path: cli - - - name: Checkout tools repo - uses: actions/checkout@v4 - with: - repository: temporalio/documentation - path: docs + submodules: recursive - name: Setup Go uses: actions/setup-go@v4 with: go-version: '1.22' - - name: Generate CLI docs - run: go run ./cli/temporalcli/internal/cmd/gen-docs + - name: Install gotestsum + run: go install gotest.tools/gotestsum@latest + + - name: Create junit-xml directory + run: mkdir junit-xml - - name: Copy files over and generate PR + - name: Test + run: gotestsum --junitfile junit-xml/${{matrix.os}}.xml -- ./... + + - name: 'Upload junit-xml artifacts' + uses: actions/upload-artifact@v4 + if: always() + with: + name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--${{matrix.os}} + path: junit-xml + retention-days: 14 + + - name: Regen code, confirm unchanged + if: ${{ matrix.checkGenCodeTarget }} + run: | + go run ./temporalcli/internal/cmd/gen-commands + git diff --exit-code + + - name: Test cloud + # Only supported in non-fork runs, since secrets are not available in forks + if: ${{ matrix.cloudTestTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/cli') }} + env: + TEMPORAL_ADDRESS: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233 + TEMPORAL_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }} + TEMPORAL_TLS_CERT: client.crt + TEMPORAL_TLS_CERT_CONTENT: ${{ secrets.TEMPORAL_CLIENT_CERT }} + TEMPORAL_TLS_KEY: client.key + TEMPORAL_TLS_KEY_CONTENT: ${{ secrets.TEMPORAL_CLIENT_KEY }} + shell: bash run: | - BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" - - cd docs - git checkout -b $BRANCH_NAME - cp ../cli/temporalcli/docs/*.mdx docs/cli/ - git add . - git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" - git push origin $BRANCH_NAME - - gh pr create \ - --body "Autogenerated PR from https://github.com/temporalio/cli" \ - --title "CLI docs update $LATEST_TAG" \ - --head "$BRANCH_NAME" \ - --base "main" + printf '%s\n' "$TEMPORAL_TLS_CERT_CONTENT" >> client.crt + printf '%s\n' "$TEMPORAL_TLS_KEY_CONTENT" >> client.key + go run ./cmd/temporal workflow list --limit 2 diff --git a/.github/workflows/trigger-publish.yml b/.github/workflows/trigger-publish.yml index 04eee3192..df58c41f3 100644 --- a/.github/workflows/trigger-publish.yml +++ b/.github/workflows/trigger-publish.yml @@ -1,14 +1,10 @@ name: 'Trigger Docker image build' - on: workflow_dispatch: release: types: [published] - jobs: - trigger: - if: ${{ ! contains(github.ref, '-rc.') }} - name: 'trigger Docker image build' + update: runs-on: ubuntu-latest defaults: @@ -16,21 +12,38 @@ jobs: shell: bash steps: - - name: Generate a token - id: generate_token - uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 + - name: Checkout repository + uses: actions/checkout@v2 + with: + path: cli + + - name: Checkout tools repo + uses: actions/checkout@v4 with: - app_id: ${{ secrets.TEMPORAL_CICD_APP_ID }} - private_key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }} + repository: temporalio/documentation + path: docs + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.22' + + - name: Generate CLI docs + run: go run ./cli/temporalcli/internal/cmd/gen-docs - - name: Dispatch docker builds Github Action - env: - PAT: ${{ steps.generate_token.outputs.token }} - PARENT_REPO: temporalio/docker-builds - PARENT_BRANCH: ${{ toJSON('main') }} - WORKFLOW_ID: update-submodules.yml - REPO: ${{ toJSON('cli') }} - BRANCH: ${{ toJSON('main') }} - COMMIT: ${{ toJSON(github.sha) }} + - name: Copy files over and generate PR run: | - curl -fL -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $PAT" "https://api.github.com/repos/$PARENT_REPO/actions/workflows/$WORKFLOW_ID/dispatches" -d '{"ref":'"$PARENT_BRANCH"', "inputs": { "repo":'"$REPO"', "branch":'"$BRANCH"', "commit": '"$COMMIT"' }}' + BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" + + cd docs + git checkout -b $BRANCH_NAME + cp ../cli/temporalcli/docs/*.mdx docs/cli/ + git add . + git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" + git push origin $BRANCH_NAME + + gh pr create \ + --body "Autogenerated PR from https://github.com/temporalio/cli" \ + --title "CLI docs update $LATEST_TAG" \ + --head "$BRANCH_NAME" \ + --base "main" From 5d8657fb4c791ce77aba4c02a746ac274dcf211d Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 19:44:47 -0800 Subject: [PATCH 04/21] Made PR, go back to using ci --- .github/workflows/ci.yaml | 88 +++++++++++---------------- .github/workflows/trigger-publish.yml | 53 ++++++---------- 2 files changed, 54 insertions(+), 87 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99e577925..0196d2f0d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,69 +1,49 @@ name: Continuous Integration on: - pull_request: - push: - branches: - - main - + workflow_dispatch: + release: + types: [published] jobs: - build-test: - strategy: - fail-fast: true - matrix: - os: [ubuntu-latest, macos-latest, macos-14, windows-latest, ubuntu-arm] - include: - - os: ubuntu-latest - checkGenCodeTarget: true - cloudTestTarget: true - - os: ubuntu-arm - runsOn: buildjet-4vcpu-ubuntu-2204-arm - runs-on: ${{ matrix.runsOn || matrix.os }} + update: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + steps: - name: Checkout repository uses: actions/checkout@v2 with: - submodules: recursive + path: cli + + - name: Checkout tools repo + uses: actions/checkout@v4 + with: + repository: temporalio/documentation + path: docs - name: Setup Go uses: actions/setup-go@v4 with: go-version: '1.22' - - name: Install gotestsum - run: go install gotest.tools/gotestsum@latest - - - name: Create junit-xml directory - run: mkdir junit-xml + - name: Generate CLI docs + run: go run ./cli/temporalcli/internal/cmd/gen-docs - - name: Test - run: gotestsum --junitfile junit-xml/${{matrix.os}}.xml -- ./... - - - name: 'Upload junit-xml artifacts' - uses: actions/upload-artifact@v4 - if: always() - with: - name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--${{matrix.os}} - path: junit-xml - retention-days: 14 - - - name: Regen code, confirm unchanged - if: ${{ matrix.checkGenCodeTarget }} - run: | - go run ./temporalcli/internal/cmd/gen-commands - git diff --exit-code - - - name: Test cloud - # Only supported in non-fork runs, since secrets are not available in forks - if: ${{ matrix.cloudTestTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/cli') }} - env: - TEMPORAL_ADDRESS: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233 - TEMPORAL_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }} - TEMPORAL_TLS_CERT: client.crt - TEMPORAL_TLS_CERT_CONTENT: ${{ secrets.TEMPORAL_CLIENT_CERT }} - TEMPORAL_TLS_KEY: client.key - TEMPORAL_TLS_KEY_CONTENT: ${{ secrets.TEMPORAL_CLIENT_KEY }} - shell: bash + - name: Copy files over and generate PR run: | - printf '%s\n' "$TEMPORAL_TLS_CERT_CONTENT" >> client.crt - printf '%s\n' "$TEMPORAL_TLS_KEY_CONTENT" >> client.key - go run ./cmd/temporal workflow list --limit 2 + BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" + + cd docs + git checkout -b $BRANCH_NAME + cp ../cli/temporalcli/docs/*.mdx docs/cli/ + git add . + git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" + git push origin $BRANCH_NAME + + gh pr create \ + --body "Autogenerated PR from https://github.com/temporalio/cli" \ + --title "CLI docs update $LATEST_TAG" \ + --head "$BRANCH_NAME" \ + --base "main" diff --git a/.github/workflows/trigger-publish.yml b/.github/workflows/trigger-publish.yml index df58c41f3..04eee3192 100644 --- a/.github/workflows/trigger-publish.yml +++ b/.github/workflows/trigger-publish.yml @@ -1,10 +1,14 @@ name: 'Trigger Docker image build' + on: workflow_dispatch: release: types: [published] + jobs: - update: + trigger: + if: ${{ ! contains(github.ref, '-rc.') }} + name: 'trigger Docker image build' runs-on: ubuntu-latest defaults: @@ -12,38 +16,21 @@ jobs: shell: bash steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - path: cli - - - name: Checkout tools repo - uses: actions/checkout@v4 + - name: Generate a token + id: generate_token + uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 with: - repository: temporalio/documentation - path: docs - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: '1.22' - - - name: Generate CLI docs - run: go run ./cli/temporalcli/internal/cmd/gen-docs + app_id: ${{ secrets.TEMPORAL_CICD_APP_ID }} + private_key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }} - - name: Copy files over and generate PR + - name: Dispatch docker builds Github Action + env: + PAT: ${{ steps.generate_token.outputs.token }} + PARENT_REPO: temporalio/docker-builds + PARENT_BRANCH: ${{ toJSON('main') }} + WORKFLOW_ID: update-submodules.yml + REPO: ${{ toJSON('cli') }} + BRANCH: ${{ toJSON('main') }} + COMMIT: ${{ toJSON(github.sha) }} run: | - BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" - - cd docs - git checkout -b $BRANCH_NAME - cp ../cli/temporalcli/docs/*.mdx docs/cli/ - git add . - git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" - git push origin $BRANCH_NAME - - gh pr create \ - --body "Autogenerated PR from https://github.com/temporalio/cli" \ - --title "CLI docs update $LATEST_TAG" \ - --head "$BRANCH_NAME" \ - --base "main" + curl -fL -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $PAT" "https://api.github.com/repos/$PARENT_REPO/actions/workflows/$WORKFLOW_ID/dispatches" -d '{"ref":'"$PARENT_BRANCH"', "inputs": { "repo":'"$REPO"', "branch":'"$BRANCH"', "commit": '"$COMMIT"' }}' From e59a2ff4ca8cde8b15413e675fea0ae55986e82f Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 19:56:47 -0800 Subject: [PATCH 05/21] need the on: pull_request trigger --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0196d2f0d..0be8031c6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,6 @@ name: Continuous Integration on: + pull_request: workflow_dispatch: release: types: [published] From 75dfb9fb26c971a7dc6a009685b48a38c1be863e Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 19:58:50 -0800 Subject: [PATCH 06/21] pwd to find working directory --- .github/workflows/update-docs.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index 0c68a0e15..2695e99ad 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -17,7 +17,7 @@ jobs: with: path: cli - - name: Checkout tools repo + - name: Checkout Documentation repo uses: actions/checkout@v4 with: repository: temporalio/documentation @@ -29,7 +29,9 @@ jobs: go-version: '1.22' - name: Generate CLI docs - run: go run ./cli/temporalcli/internal/cmd/gen-docs + run: | + pwd + go run ./temporalcli/internal/cmd/gen-docs - name: Copy files over and generate PR run: | From a6f5204e730e70f780240569b32bba89efaf34ae Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 20:00:10 -0800 Subject: [PATCH 07/21] echo pwd --- .github/workflows/update-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index 2695e99ad..77e834cf7 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -30,7 +30,7 @@ jobs: - name: Generate CLI docs run: | - pwd + echo "$pwd" go run ./temporalcli/internal/cmd/gen-docs - name: Copy files over and generate PR From 155039d28d3d7707fd39a5b896d8a60d47b3a9d4 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 20:01:22 -0800 Subject: [PATCH 08/21] Edited the wrong file.. --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0be8031c6..15419b2c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,7 +30,10 @@ jobs: go-version: '1.22' - name: Generate CLI docs - run: go run ./cli/temporalcli/internal/cmd/gen-docs + run: | + pwd + echo "$pwd" + go run ./temporalcli/internal/cmd/gen-docs - name: Copy files over and generate PR run: | From 367f7ecc510d6092802d4af49389001a3252e0a7 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 20:04:34 -0800 Subject: [PATCH 09/21] Debug path --- .github/workflows/ci.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 15419b2c7..b82a4c73a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,17 @@ jobs: run: | pwd echo "$pwd" - go run ./temporalcli/internal/cmd/gen-docs + ls + ls temporalcli + ls temporalcli/internal + ls temporalcli/internal/cmd + ls temporalcli/internal/cmd/gen-docs + cd temporalcli + cd internal + cd cmd + cd gen-docs + + go run . - name: Copy files over and generate PR run: | From faa330ab1d050e80d0b662789399d01b02c88d9a Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 20:06:01 -0800 Subject: [PATCH 10/21] set -x --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b82a4c73a..6755a50d7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,6 +31,7 @@ jobs: - name: Generate CLI docs run: | + set -x pwd echo "$pwd" ls @@ -38,6 +39,7 @@ jobs: ls temporalcli/internal ls temporalcli/internal/cmd ls temporalcli/internal/cmd/gen-docs + cd cli cd temporalcli cd internal cd cmd From 4b6d191df6ab52165fec7e56c807530b3dd53295 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 20:08:13 -0800 Subject: [PATCH 11/21] one directory off --- .github/workflows/ci.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6755a50d7..fccb64e6d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,7 @@ jobs: uses: actions/checkout@v2 with: path: cli + submodules: recursive - name: Checkout tools repo uses: actions/checkout@v4 @@ -35,10 +36,10 @@ jobs: pwd echo "$pwd" ls - ls temporalcli - ls temporalcli/internal - ls temporalcli/internal/cmd - ls temporalcli/internal/cmd/gen-docs + ls cli/temporalcli + ls cli/temporalcli/internal + ls cli/temporalcli/internal/cmd + ls cli/temporalcli/internal/cmd/gen-docs cd cli cd temporalcli cd internal @@ -46,6 +47,7 @@ jobs: cd gen-docs go run . + go run ./cli/temporalcli/internal/cmd/gen-docs - name: Copy files over and generate PR run: | From 8a925bfa17ffa5b064c7848e8c32348a532e0c82 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 20:14:52 -0800 Subject: [PATCH 12/21] back to original command --- .github/workflows/ci.yaml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fccb64e6d..d593add74 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,23 +31,7 @@ jobs: go-version: '1.22' - name: Generate CLI docs - run: | - set -x - pwd - echo "$pwd" - ls - ls cli/temporalcli - ls cli/temporalcli/internal - ls cli/temporalcli/internal/cmd - ls cli/temporalcli/internal/cmd/gen-docs - cd cli - cd temporalcli - cd internal - cd cmd - cd gen-docs - - go run . - go run ./cli/temporalcli/internal/cmd/gen-docs + run: go run ./cli/temporalcli/internal/cmd/gen-docs - name: Copy files over and generate PR run: | From 0032e5d77de64b12eefb9b0aab7493412eb2ef82 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Thu, 5 Dec 2024 20:18:49 -0800 Subject: [PATCH 13/21] use cd and go run . --- .github/workflows/ci.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d593add74..1e4844f76 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,7 +31,12 @@ jobs: go-version: '1.22' - name: Generate CLI docs - run: go run ./cli/temporalcli/internal/cmd/gen-docs + run: | + set -x + pwd + echo "$pwd" + cd cli/temporalcli/internal/cmd/gen-docs + go run . - name: Copy files over and generate PR run: | From c5b437852e76c8cd972bc862247afe5c09a86c1e Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 6 Dec 2024 17:33:15 -0800 Subject: [PATCH 14/21] Test using a release on my own fork --- .github/workflows/ci.yaml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1e4844f76..11dd9009f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,9 +32,6 @@ jobs: - name: Generate CLI docs run: | - set -x - pwd - echo "$pwd" cd cli/temporalcli/internal/cmd/gen-docs go run . @@ -49,6 +46,27 @@ jobs: git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" git push origin $BRANCH_NAME + # TEMP + echo "Release published by: ${{ github.event.release.author.login }}" + + # Query the GitHub API for the release author + API_RESPONSE=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ + https://api.github.com/users/${{ github.event.release.author.login }}) + + # Extract the email field from the API response + EMAIL=$(echo "$API_RESPONSE" | jq -r '.email') + + # If no public email is found, fallback to a default + if [ "$EMAIL" == "null" ]; then + # TODO: josh's email? + EMAIL="default-user@default-domain.com" + fi + + + # Setup the committers identity. + git config user.email "$EMAIL" + git config user.name "${{ github.event.release.author.login }}" + gh pr create \ --body "Autogenerated PR from https://github.com/temporalio/cli" \ --title "CLI docs update $LATEST_TAG" \ From 41b487ef45a0bd016de6f8fdc02df398300c2c25 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 6 Dec 2024 17:37:01 -0800 Subject: [PATCH 15/21] Identity must be set before commit --- .github/workflows/ci.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 11dd9009f..86b6faa0f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,13 +39,6 @@ jobs: run: | BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" - cd docs - git checkout -b $BRANCH_NAME - cp ../cli/temporalcli/docs/*.mdx docs/cli/ - git add . - git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" - git push origin $BRANCH_NAME - # TEMP echo "Release published by: ${{ github.event.release.author.login }}" @@ -61,12 +54,21 @@ jobs: # TODO: josh's email? EMAIL="default-user@default-domain.com" fi - + # Setup the committers identity. git config user.email "$EMAIL" git config user.name "${{ github.event.release.author.login }}" + cd docs + git checkout -b $BRANCH_NAME + cp ../cli/temporalcli/docs/*.mdx docs/cli/ + git add . + git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" + git push origin $BRANCH_NAME + + + gh pr create \ --body "Autogenerated PR from https://github.com/temporalio/cli" \ --title "CLI docs update $LATEST_TAG" \ From f1217c7eed0839a85b6f3c02adf7f9c3ac14975d Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 6 Dec 2024 17:40:17 -0800 Subject: [PATCH 16/21] cd into docs repo --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86b6faa0f..e98ebf50b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,6 +39,8 @@ jobs: run: | BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" + cd docs + # TEMP echo "Release published by: ${{ github.event.release.author.login }}" @@ -60,7 +62,6 @@ jobs: git config user.email "$EMAIL" git config user.name "${{ github.event.release.author.login }}" - cd docs git checkout -b $BRANCH_NAME cp ../cli/temporalcli/docs/*.mdx docs/cli/ git add . From dea6ee523c38fb428abeb94ebb14cfcdf4dbe6be Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 6 Dec 2024 17:41:54 -0800 Subject: [PATCH 17/21] set git config global --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e98ebf50b..65a444c6c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,6 +37,7 @@ jobs: - name: Copy files over and generate PR run: | + set -x BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" cd docs @@ -59,8 +60,8 @@ jobs: # Setup the committers identity. - git config user.email "$EMAIL" - git config user.name "${{ github.event.release.author.login }}" + git config --global user.email "$EMAIL" + git config --global user.name "${{ github.event.release.author.login }}" git checkout -b $BRANCH_NAME cp ../cli/temporalcli/docs/*.mdx docs/cli/ From 222ad54670707b7444c6571718aa4be4b4fcac7e Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 6 Dec 2024 17:56:10 -0800 Subject: [PATCH 18/21] confirmed github.event.release.author.login works, now manually setting to yuandrew so I can test in CI without creating a release --- .github/workflows/ci.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 65a444c6c..c4f4363f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,12 +42,10 @@ jobs: cd docs - # TEMP - echo "Release published by: ${{ github.event.release.author.login }}" - + # TODO: replace yuandrew with ${{ github.event.release.author.login }} # Query the GitHub API for the release author - API_RESPONSE=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ - https://api.github.com/users/${{ github.event.release.author.login }}) + API_RESPONSE=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/users/yuandrew) # Extract the email field from the API response EMAIL=$(echo "$API_RESPONSE" | jq -r '.email') @@ -61,7 +59,7 @@ jobs: # Setup the committers identity. git config --global user.email "$EMAIL" - git config --global user.name "${{ github.event.release.author.login }}" + git config --global user.name "yuandrew" git checkout -b $BRANCH_NAME cp ../cli/temporalcli/docs/*.mdx docs/cli/ From 8c0aec2a681e7e70835525b8d92b9dfb606640b2 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 6 Dec 2024 17:57:59 -0800 Subject: [PATCH 19/21] Try with permissions: contents: write --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c4f4363f1..da8cbed08 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,8 @@ on: jobs: update: runs-on: ubuntu-latest - + permissions: + contents: write defaults: run: shell: bash From 4cf189e3dbe60191fdf27c91967db61cbce89cda Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 21 Mar 2025 12:39:05 -0700 Subject: [PATCH 20/21] refresh where I left off at --- .github/workflows/ci.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1ad353527..cc8a54a76 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,7 +52,7 @@ jobs: cd cli/temporalcli/internal/cmd/gen-docs go run . - - name: Copy files over and generate PR + - name: Publish generated docs to documentation repo # - name: Test cloud # if: ${{ matrix.cloudTestTarget && env.HAS_SECRETS == 'true' }} # env: @@ -64,23 +64,32 @@ jobs: # TEMPORAL_TLS_KEY_CONTENT: ${{ secrets.TEMPORAL_CLIENT_KEY }} # shell: bash run: | + set -e set -x + BRANCH_NAME="cli-update-docs-${{ github.ref_name }}" cd docs # TODO: replace yuandrew with ${{ github.event.release.author.login }} + # can this not be done until we "release"? # Query the GitHub API for the release author API_RESPONSE=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ https://api.github.com/users/yuandrew) # Extract the email field from the API response + AUTHOR_LOGIN=$(echo "$API_RESPONSE" | jq -r '.author.login') + echo "author_login: $AUTHOR_LOGIN" + EMAIL=$(echo "$API_RESPONSE" | jq -r '.author.email') + echo "EMAIL: $EMAIL" EMAIL=$(echo "$API_RESPONSE" | jq -r '.email') + echo "EMAIL: $EMAIL" # If no public email is found, fallback to a default if [ "$EMAIL" == "null" ]; then - # TODO: josh's email? - EMAIL="default-user@default-domain.com" + echo "falling back on default email" + EMAIL="andrew.yuan@temporal.io" + # TODO: sdk@temporal.io fi @@ -91,7 +100,8 @@ jobs: git checkout -b $BRANCH_NAME cp ../cli/temporalcli/docs/*.mdx docs/cli/ git add . - git commit -m "CLI docs update, autogenerated on CLI release, ${{ github.ref_name }}" + # TODO: mention CLI release version + git commit -m "CLI docs update, autogenerated on CLI release $LATEST_TAG, ${{ github.ref_name }}" git push origin $BRANCH_NAME From f9d1701582ddabd1453c8503e246249893b70057 Mon Sep 17 00:00:00 2001 From: Andrew Yuan Date: Fri, 21 Mar 2025 12:52:07 -0700 Subject: [PATCH 21/21] Try to use same generate_token action that api/api-go use --- .github/workflows/ci.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cc8a54a76..0e4d5af77 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,10 +36,18 @@ jobs: path: cli submodules: recursive - - name: Checkout tools repo + - 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 }} + + - name: Checkout docs repo uses: actions/checkout@v4 with: repository: temporalio/documentation + token: ${{ steps.generate_token.outputs.token }} path: docs - name: Setup Go @@ -74,7 +82,7 @@ jobs: # TODO: replace yuandrew with ${{ github.event.release.author.login }} # can this not be done until we "release"? # Query the GitHub API for the release author - API_RESPONSE=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + API_RESPONSE=$(curl -s -H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \ https://api.github.com/users/yuandrew) # Extract the email field from the API response