3838 LLVM_TOKEN_GENERATOR_PRIVATE_KEY :
3939 description : " Private key for our GitHub App we use for generating access tokens."
4040 required : true
41+ # Run on pull_requests for testing purposes.
42+ pull_request :
43+ paths :
44+ - ' .github/workflows/release-documentation.yml'
45+ - ' llvm/utils/release/build-docs.sh'
46+ types :
47+ - opened
48+ - synchronize
49+ - reopened
50+ # When a PR is closed, we still start this workflow, but then skip
51+ # all the jobs, which makes it effectively a no-op. The reason to
52+ # do this is that it allows us to take advantage of concurrency groups
53+ # to cancel in progress CI jobs whenever the PR is closed.
54+ - closed
55+
56+ concurrency :
57+ group : release-documentation-${{ inputs.release-version || github.event.pull_request.number }}
58+ cancel-in-progress : true
4159
4260jobs :
43- # This job checks permissions and validates inputs to prevent potential
44- # malicious actions. Since the release-documentation job has contents: write
45- # permissions we need to be extra careful about who can run the job and what
46- # inputs can be provided.
47- release-man-pages-validate-input :
48- name : Release Man Pages Validate Input
49- runs-on : ubuntu-24.04
50- environment :
51- name : release
52- deployment : false
53- permissions :
54- contents : read
55- steps :
56- - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
57- with :
58- persist-credentials : false
59- sparse-checkout : |
60- .github/workflows/
61-
62- - name : Check Permissions
63- uses : ./.github/workflows/require-team-membership
64- with :
65- team-slug : llvm-release-managers
66- LLVM_TOKEN_GENERATOR_CLIENT_ID : ${{ secrets.LLVM_TOKEN_GENERATOR_CLIENT_ID }}
67- LLVM_TOKEN_GENERATOR_PRIVATE_KEY : ${{ secrets.LLVM_TOKEN_GENERATOR_PRIVATE_KEY }}
68-
69- - name : Validate Input
70- uses : ./.github/workflows/validate-release-version
71- with :
72- release-version : ${{ inputs.release-version }}
73-
7461 release-documentation :
7562 name : Build and Upload Release Documentation and Man Pages
7663 runs-on : ubuntu-24.04
77- needs :
78- - release-man-pages-validate-input
64+ if : >-
65+ github.repository_owner == 'llvm' &&
66+ github.event.action != 'closed'
7967 outputs :
8068 man-page-digest : ${{ steps.man-page-digest.outputs.man-page-digest }}
8169 man-page-artifact-id : ${{ steps.man-page-artifact-upload.outputs.artifact-id }}
82-
83- man-page-release-version : ${{ steps.vars.outputs.man-page-release-version }}
84- man-page-tarball-name : ${{ steps.vars.outputs.man-page-tarball-name }}
85- man-page-upload : ${{ steps.vars.outputs.man-page-upload }}
86- man-page-attestation-name : ${{ steps.vars.outputs.man-page-attestation-name }}
87- env :
88- upload : ${{ inputs.upload && !contains(inputs.release-version, 'rc') }}
8970 steps :
90- - name : Collect Variables
91- id : vars
92- env :
93- INPUTS_RELEASE_VERSION : ${{ inputs.release-version }}
94- UPLOAD_MAN_PAGES : ${{ inputs.upload }}
95- shell : bash
96- run : |
97- {
98- echo "man-page-release-version=$INPUTS_RELEASE_VERSION"
99- echo "man-page-tarball-name=llvm_man_pages-$INPUTS_RELEASE_VERSION.tar.xz"
100- echo "man-page-ref=llvmorg-$INPUTS_RELEASE_VERSION"
101- echo "man-page-upload=$UPLOAD_MAN_PAGES"
102- echo "man-page-attestation-name=$RUNNER_OS-$RUNNER_ARCH-release-man-page-attestation"
103- } >> "$GITHUB_OUTPUT"
104-
10571 - name : Checkout LLVM
10672 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
10773 with :
10874 persist-credentials : false
10975
11076 - name : Validate Input
77+ if : inputs.release-version
11178 uses : ./.github/workflows/validate-release-version
11279 with :
11380 release-version : ${{ inputs.release-version }}
@@ -129,34 +96,54 @@ jobs:
12996 pip3 install --require-hashes --user -r ./llvm/docs/requirements.txt
13097
13198 - name : Build Documentation
99+ id : build
132100 env :
133101 GITHUB_TOKEN : ${{ github.token }}
134102 INPUTS_RELEASE_VERSION : ${{ inputs.release-version }}
135103 run : |
136- ./llvm/utils/release/build-docs.sh -release "$INPUTS_RELEASE_VERSION" -no-doxygen
104+ ./llvm/utils/release/build-docs.sh \
105+ $(test -n "$INPUTS_RELEASE_VERSION" && echo -release "$INPUTS_RELEASE_VERSION" || echo -srcdir llvm) -no-doxygen
106+ echo "man-page-tarball-name=$(basename $(find . -iname 'llvm_man_pages-*.tar.xz'))" >> "$GITHUB_OUTPUT"
107+
137108
138109 - name : Generate sha256 digest for man page tarball
139110 id : man-page-digest
140111 shell : bash
141112 env :
142- TARBALL_NAME : ${{ steps.vars .outputs.man-page-tarball-name }}
113+ TARBALL_NAME : ${{ steps.build .outputs.man-page-tarball-name }}
143114 run : |
144- echo "man-page-digest=$(cat "$TARBALL_NAME" | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
115+ echo "man-page-digest=$(cat "$TARBALL_NAME" | sha256sum | cut -d ' ' -f 1)" >> " $GITHUB_OUTPUT"
145116
146117 - id : man-page-artifact-upload
147118 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
148119 with :
120+ name : man-pages
149121 path : |
150- ${{ steps.vars .outputs.man-page-tarball-name }}
122+ ${{ steps.build .outputs.man-page-tarball-name }}
151123
152124 - name : Create Release Notes Artifact
153125 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
154126 with :
155127 name : release-notes
156128 path : docs-build/html-export/
157129
130+
131+ upload-release-notes :
132+ name : " Upload Release Notes"
133+ runs-on : ubuntu-24.04
134+ environment :
135+ deployment : false
136+ name : release
137+ needs :
138+ - release-documentation
139+ if : >-
140+ github.event_name != 'pull_request' &&
141+ inputs.upload &&
142+ !contains(inputs.release-version, 'rc')
143+ permissions :
144+ contents : read
145+ steps :
158146 - name : Clone www-releases
159- if : env.upload
160147 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
161148 with :
162149 repository : ${{ github.repository_owner }}/www-releases
@@ -165,15 +152,19 @@ jobs:
165152 path : www-releases
166153 persist-credentials : false
167154
155+ - name : Download Release Notes Artifact
156+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
157+ id : download-artifact
158+ with :
159+ name : release-notes
160+ path : ${{ github.workspace }}/www-releases/${{ inputs.release-version }}
161+
168162 - name : Upload Release Notes
169- if : env.upload
170163 env :
171164 PUSH_TOKEN : ${{ secrets.LLVMBOT_WWW_RELEASES_PUSH }}
172165 GH_TOKEN : ${{ secrets.WWW_RELEASES_TOKEN }}
173166 INPUTS_RELEASE_VERSION : ${{ inputs.release-version }}
174167 run : |
175- mkdir -p www-releases/$INPUTS_RELEASE_VERSION
176- mv ./docs-build/html-export/* www-releases/$INPUTS_RELEASE_VERSION
177168 cd www-releases
178169 git checkout -b $INPUTS_RELEASE_VERSION
179170 git add $INPUTS_RELEASE_VERSION
@@ -203,10 +194,10 @@ jobs:
203194 id : man-page-artifact-upload
204195 uses : $/.github/workflows/upload-release-artifact
205196 with :
206- release-version : ${{ needs.release-documentation.outputs.man-page- release-version }}
197+ release-version : ${{ inputs. release-version }}
207198 artifact-id : ${{ needs.release-documentation.outputs.man-page-artifact-id }}
208- attestation-name : ${{ needs.release-documentation.outputs. man-page-attestation-name }}
199+ attestation-name : ${{ runner.os }}-${{ runner.arch }}-release- man-page-attestation
209200 digest : ${{ needs.release-documentation.outputs.man-page-digest }}
210- upload : ${{ needs.release-documentation.outputs.man-page- upload }}
201+ upload : ${{ inputs. upload }}
211202 LLVM_TOKEN_GENERATOR_CLIENT_ID : ${{ secrets.LLVM_TOKEN_GENERATOR_CLIENT_ID }}
212203 LLVM_TOKEN_GENERATOR_PRIVATE_KEY : ${{ secrets.LLVM_TOKEN_GENERATOR_PRIVATE_KEY }}
0 commit comments