@@ -4,6 +4,19 @@ permissions:
44 contents : read
55
66on :
7+ workflow_dispatch :
8+ inputs :
9+ documentation_tag :
10+ type : string
11+ required : false
12+ default : " latest"
13+ description : " Label of the documentation"
14+ publish_to_prod :
15+ type : boolean
16+ default : true
17+ publish_to_dev :
18+ type : boolean
19+ default : true
720 pull_request :
821 types : [opened, synchronize, reopened]
922 branches :
7588 ls -lah .
7689 pwd
7790
91+ - name : Upload artifact
92+ uses : actions/upload-artifact@v4
93+ with :
94+ name : doc-build
95+ if-no-files-found : error
96+ retention-days : 2
97+ path : |
98+ doc/build/html/${{env.ARCHIVE}}
99+
78100 - name : Check version
79101 run : |
80102 VERSION_REGEX="^v([0-9a-zA-Z\.\-]+)$"
@@ -120,84 +142,11 @@ jobs:
120142 mv "${MONITOR}" "$PUBLISH"
121143 if [[ -f pr.txt ]]; then mv pr.txt "$PUBLISH"; fi
122144
123- - name : Unzip html archive
124- working-directory : doc
125- run : |
126- OUTDIR=$(awk 'NR==1 { if ($3 ~ /^(latest|PR-[0-9]+|[0-9]+\.[0-9a-zA-Z\.\-]+)$/) print $3 }' monitor_*.txt)
127- echo "OUTDIR=$OUTDIR" >> "$GITHUB_ENV"
128- unzip legacy-addon-serial-modem*.zip -d $OUTDIR
129- find "$OUTDIR" -type l -delete
130-
131- - name : Obtain PR number
132- if : ${{ github.event.workflow_run.event == 'pull_request' }}
133- working-directory : doc
134- run : |
135- if [ -f pr.txt ]; then
136- PR=$(head -n 1 pr.txt | tr -cd '0-9')
137- fi
138- printf 'PR=%s\n' "$PR" >> "$GITHUB_ENV"
139-
140- - name : Upload to Azure storage
141- working-directory : doc
142- env :
143- AZCOPY_CONCURRENCY_VALUE : 1024
144- NCS_DOC_SAS_PRS : ${{ secrets.NCS_DOC_SAS_PRS }}
145- NCS_DOC_SAS_MAIN : ${{ secrets.NCS_DOC_SAS_MAIN }}
146- run : |
147- if [[ "${{ github.event.workflow_run.event }}" == "pull_request" ]]; then
148- azcopy cp $OUTDIR "${{ vars.NCS_DOC_PR_STORAGE_URL }}addons/serial-modem?$NCS_DOC_SAS_PRS" --recursive=true
149- else
150- azcopy cp $OUTDIR "${{ vars.NCS_DOC_STORAGE_URL }}addons/serial-modem?$NCS_DOC_SAS_MAIN" --recursive=true
151- fi
152-
153- - name : Upload artifact
145+ - name : Store
146+ if : ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }}
154147 uses : actions/upload-artifact@v4
155148 with :
156- name : doc-build
157- if-no-files-found : error
158- retention-days : 2
149+ name : docs
150+ retention-days : 5
159151 path : |
160- doc/build/html/${{env.ARCHIVE}}
161-
162- - name : Prepare Key
163- run : |
164- mkdir -p ~/.ssh
165- ssh-keyscan upload-v1.zoominsoftware.io >> ~/.ssh/known_hosts
166-
167- echo "${{ secrets.ZOOMIN_KEY }}" > zoomin_key
168- chmod 600 zoomin_key
169-
170- - name : Publish documentation - prod
171- if : ${{inputs.publish_to_prod}}
172- run : |
173- sftp -v -i zoomin_key nordic@upload-v1.zoominsoftware.io <<EOF
174- cd docs-be.nordicsemi.com/sphinx-html/incoming
175- put doc/build/html/${{env.ARCHIVE}}
176- EOF
177-
178- - name : Publish documentation - dev
179- if : ${{inputs.publish_to_dev}}
180- run : |
181- sftp -v -i zoomin_key nordic@upload-v1.zoominsoftware.io <<EOF
182- cd nordic-be-dev.zoominsoftware.io/sphinx-html/incoming
183- put doc/build/html/${{env.ARCHIVE}}
184- EOF
185-
186- - name : Find Comment
187- if : ${{ github.event.workflow_run.event == 'pull_request' }}
188- uses : peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3
189- id : fc
190- with :
191- issue-number : ${{ env.PR }}
192- comment-author : ' github-actions[bot]'
193- body-includes : documentation preview
194-
195- - name : Create or update comment
196- if : ${{ github.event.workflow_run.event == 'pull_request' }}
197- uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
198- with :
199- comment-id : ${{ steps.fc.outputs.comment-id }}
200- issue-number : ${{ env.PR }}
201- body : |
202- You can find the documentation preview for this PR [here](${{ vars.NCS_DOC_PR_HOSTING_URL }}addons/serial-modem/PR-${{ env.PR }}/).
203- edit-mode : replace
152+ publish/*
0 commit comments