-
Notifications
You must be signed in to change notification settings - Fork 302
90 lines (79 loc) · 2.75 KB
/
update-cli-docs.yml
File metadata and controls
90 lines (79 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: 'CLI Docs Update'
on:
workflow_dispatch:
inputs:
cli_release_tag:
description: 'Release tag from the CLI repo to update docs from'
required: true
commit_author:
description: 'Name to use for the commit author'
required: true
commit_author_email:
description: 'Email to use for the commit author'
required: true
commit_message:
description: 'Commit message for the docs update'
required: true
jobs:
update:
name: 'Pull changes from the CLI repo and update CLI docs'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
defaults:
run:
shell: bash
steps:
- 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:
persist-credentials: true
token: ${{ steps.generate_token.outputs.token }}
path: docs
ref: main
- name: Checkout CLI repo
uses: actions/checkout@v4
with:
path: cli
ref: ${{ github.event.inputs.cli_release_tag }}
submodules: recursive
persist-credentials: true
token: ${{ steps.generate_token.outputs.token }}
repository: temporalio/cli
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Generate CLI docs
working-directory: cli
run: go run ./cmd/gen-docs -input internal/temporalcli/commands.yaml -input cliext/option-sets.yaml -output dist/docs
- name: Publish generated docs to documentation repo
env:
GH_TOKEN: ${{ github.token }}
COMMIT_AUTHOR: ${{ github.event.inputs.commit_author }}
COMMIT_AUTHOR_EMAIL: ${{ github.event.inputs.commit_author_email }}
CLI_RELEASE_TAG: ${{ github.event.inputs.cli_release_tag }}
COMMIT_MESSAGE: ${{ github.event.inputs.commit_message }}
working-directory: docs
run: |
set -ex
git config user.name "$COMMIT_AUTHOR"
git config user.email "$COMMIT_AUTHOR_EMAIL"
branch_name="update-cli-docs-$CLI_RELEASE_TAG"
git checkout -b "$branch_name"
cp ../cli/dist/docs/*.mdx docs/cli/
git add .
git commit -m "$COMMIT_MESSAGE"
git push origin "$branch_name"
gh pr create \
--body "Autogenerated PR from https://github.com/temporalio/cli" \
--title "$COMMIT_MESSAGE" \
--head "$branch_name" \
--base "main"