Publish documentation to PanDev for release v0.2.0 #1
Workflow file for this run
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: (publish) Documentation | |
run-name: Publish documentation to PanDev for release ${{ github.event.release.tag_name }} | |
on: | |
release: | |
types: released | |
permissions: | |
contents: read | |
jobs: | |
cleanup_pandev: | |
name: Cleanup documentation release PRs @PAN.DEV | |
runs-on: ubuntu-latest | |
steps: | |
- name: cleanup old PRs | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
github-token: ${{ secrets.CLSC_PAT }} | |
script: | | |
let prs = await github.rest.pulls.list({ | |
owner: "PaloAltoNetworks", | |
repo: "pan.dev", | |
state: "open", | |
}) | |
let prs_list = prs.data | |
console.log("Total PRs found: " + prs_list.length) | |
let found = false | |
let pr_no | |
if (prs_list.length > 0){ | |
console.log("Removing obsolete PRs:") | |
for (let pr of prs_list){ | |
if (pr.head.label.includes("PaloAltoNetworks:pua_release_v")) { | |
console.log(" - removing PR (#" + pr.number + ") " + pr.title + " -> " + pr.url) | |
await github.rest.pulls.update({ | |
owner: "PaloAltoNetworks", | |
repo: "pan.dev", | |
pull_number: pr.number, | |
state: "closed", | |
}) | |
} | |
} | |
} | |
store_documentation: | |
name: Fetch the updated documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
- name: pack the documentation | |
working-directory: docs | |
run: tar --exclude .DS_Store --exclude sidebars.js -cvf documentation.tar * | |
- name: upload the documentation artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: documentation | |
path: docs/documentation.tar | |
update_pandev: | |
name: Create a PR for pan.dev | |
needs: | |
- cleanup_pandev | |
- store_documentation | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: checkout pan.dev | |
uses: actions/checkout@v3 | |
with: | |
repository: PaloAltoNetworks/pan.dev | |
token: ${{ secrets.CLSC_PAT }} | |
- name: download documentation artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: documentation | |
path: products/panos/docs | |
- name: unpack the documentation | |
working-directory: products/panos/docs | |
run: | | |
rm -rf 'panos-upgrade-assurance' | |
tar xvf documentation.tar | |
rm -f documentation.tar | |
- name: create a PR to upstream pan.dev | |
id: pr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.CLSC_PAT }} | |
delete-branch: true | |
branch: "pua_release_${{ github.event.release.tag_name }}" | |
title: "[PAN-OS Upgrade Assurance] documentation update for release: ${{ github.event.release.tag_name }}" | |
commit-message: "docs: PanOS Upgrade Assurance documentation update" | |
labels: netsec | |
body: | | |
# Description | |
A PR made for changes introduced into documentation on ${{ github.event.release.tag_name }} release. | |
# Types of changes | |
New feature (non-breaking change which adds functionality) |