Skip to content

Documentation Publish #3

Documentation Publish

Documentation Publish #3

Workflow file for this run

name: Documentation Publish
on:
workflow_run:
workflows: ["Documentation Build", "Documentation Remove"]
types:
- completed
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "doc"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/doc.zip', Buffer.from(download.data));
- name: Upload documentation
env:
SSHUSER: ${{ secrets.NCS_TRANSFER_DOC_USR }}
SSHPASS: ${{ secrets.NCS_TRANSFER_DOC_PWD }}
run: |
sudo apt install -y sshpass
unzip doc.zip
# Don't upload the archive and workflow metadata
files=$(ls -I doc.zip -I pr.txt)
mkdir -p ~/.ssh && \
ssh-keyscan -p 2222 transfer.nordicsemi.no >> ~/.ssh/known_hosts
for file in $files; do
echo "put ${file}" | \
sshpass -e sftp -P 2222 -o BatchMode=no -b - $SSHUSER@transfer.nordicsemi.no
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: pr.txt