Documentation Publish #172
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Documentation Publish | |
on: | |
workflow_run: | |
workflows: ["Documentation Build"] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Download artifacts | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: docbuild.yml | |
run_id: ${{ github.event.workflow_run.id }} | |
- name: Install dependencies | |
run: | | |
sudo apt install -y sshpass | |
- name: Upload documentation | |
env: | |
SSHUSER: ${{ secrets.NCS_TRANSFER_DOC_USR }} | |
SSHPASS: ${{ secrets.NCS_TRANSFER_DOC_PWD }} | |
run: | | |
# trust server | |
mkdir -p ~/.ssh && \ | |
ssh-keyscan -p 2222 transfer.nordicsemi.no >> ~/.ssh/known_hosts | |
# upload files | |
for file in docs/*.zip docs/monitor*.txt; do | |
echo "put ${file}" | \ | |
sshpass -e sftp -P 2222 -o BatchMode=no -b - $SSHUSER@transfer.nordicsemi.no | |
done | |
- name: Upload Zoomin documentation | |
run: | | |
for file in docs/monitor*.txt; do | |
if ! grep -q main ${file}; then | |
echo "Not targeting main, skipping Zoomin upload" | |
exit 0 | |
fi | |
done | |
# trust server | |
mkdir -p ~/.ssh | |
ssh-keyscan upload-v1.zoominsoftware.io >> ~/.ssh/known_hosts | |
# prepare key | |
echo "${{ secrets.NCS_ZOOMIN_KEY }}" | base64 -d > zoomin_key | |
chmod 600 zoomin_key | |
# upload files | |
for file in docs/*.zip; do | |
sftp -v -i zoomin_key nordic@upload-v1.zoominsoftware.io <<EOF | |
cd docs-be.nordicsemi.com/sphinx-html/incoming | |
put ${file} | |
cd ../../../nordic-be-dev.zoominsoftware.io/sphinx-html/incoming | |
put ${file} | |
quit | |
EOF | |
done | |
- name: Add preview URL comment for PRs | |
uses: carlescufi/action-doc-url@main | |
with: | |
github-token: ${{ secrets.NCS_GITHUB_TOKEN }} | |
urlroot: ${{ secrets.NCS_DOC_URL_ROOT }} | |
pr-prefix: "PR-" | |
pr-file: docs/pr.txt |