1
1
---
2
2
name : Publish Docs
3
-
4
3
on :
5
4
workflow_call :
6
5
inputs :
7
6
tag :
8
7
type : string
9
8
description : The tag to use for creating docs branch or merging to docs branch.
10
9
required : true
11
-
12
10
permissions :
13
11
actions : read
14
12
contents : write
15
13
pull-requests : write
16
14
id-token : write
17
-
18
15
jobs :
19
16
docs :
20
17
name : publish docs
@@ -29,23 +26,19 @@ jobs:
29
26
with :
30
27
app-id : ${{ vars.GH_APP_ID }}
31
28
private-key : ${{ secrets.GH_APP_PRIVATE_KEY }}
32
-
33
29
- name : Checkout tag
34
30
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35
31
with :
36
32
ref : ${{ inputs.tag }}
37
33
token : ${{ steps.gh-app-token.outputs.token }}
38
-
39
34
- name : Slack notification
40
35
uses : act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
41
36
with :
42
37
status : starting
43
38
steps : ${{ toJson(steps) }}
44
39
channel : ${{ env.SLACK_CHANNEL }}
45
- message : Starting creating docs for ${{ github.repository }} with tag ${{
46
- inputs.tag }}......
40
+ message : Starting creating docs for ${{ github.repository }} with tag inputs.tag }}......
47
41
if : always()
48
-
49
42
- name : Validate Tag
50
43
id : validate_tag
51
44
run : |-
@@ -57,16 +50,12 @@ jobs:
57
50
echo "Error: Tag '$TAG' is not a valid semantic version."
58
51
exit 1
59
52
fi
60
-
61
53
IFS='.' read -r MAJOR MINOR PATCH <<< "${TAG#v}"
62
-
63
54
echo "Major: $MAJOR, Minor: $MINOR, Patch: $PATCH"
64
55
RELEASE_BRANCH="release-v${MAJOR}.${MINOR}.0"
65
- DOCS_BRANCH="docs-v${MAJOR}.${MINOR}.0"
66
-
56
+ DOCS_BRANCH="docs-v${MAJOR}.${MINOR}"
67
57
echo "DOCS_BRANCH=${DOCS_BRANCH}" >> $GITHUB_OUTPUT
68
58
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT
69
-
70
59
if [ "$PATCH" -ne 0 ]; then
71
60
# If it's a patch version, create a PR to merge release branch into docs branch
72
61
echo "Creating PR to merge ${RELEASE_BRANCH} into ${DOCS_BRANCH}"
@@ -76,25 +65,21 @@ jobs:
76
65
echo "Creating new docs branch ${DOCS_BRANCH}"
77
66
fi
78
67
echo "PR_TITLE=${PR_TITLE:-}" >> $GITHUB_OUTPUT
79
-
80
68
- name : Create Pull Request for Docs
81
69
if : ${{ steps.validate_tag.outputs.PR_TITLE != '' }}
82
70
uses : peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
83
71
with :
84
72
token : ${{ steps.gh-app-token.outputs.token }}
85
73
title : ${{ steps.validate_tag.outputs.PR_TITLE }}
86
- body : Automatically generated PR to merge release branch into docs branch
87
- for patch version update.
74
+ body : Automatically generated PR to merge release branch into docs branch for patch version update.
88
75
base : ${{ steps.validate_tag.outputs.DOCS_BRANCH }}
89
76
sign-commits : true
90
77
branch : ${{ steps.validate_tag.outputs.RELEASE_BRANCH }}
91
78
commit-message : ${{ steps.validate_tag.outputs.PR_TITLE }}
92
-
93
79
- name : Create Docs Branch
94
80
if : ${{ steps.validate_tag.outputs.PR_TITLE == '' }}
95
81
run : |
96
82
echo "Creating docs branch ${DOCS_BRANCH}"
97
-
98
83
git checkout -b "${DOCS_BRANCH}"
99
84
git push origin "${DOCS_BRANCH}"
100
85
env :
0 commit comments