diff --git a/.github/workflows/pmem.io_doc_update.yml b/.github/workflows/pmem.io_doc_update.yml new file mode 100644 index 00000000000..8dce6d866ad --- /dev/null +++ b/.github/workflows/pmem.io_doc_update.yml @@ -0,0 +1,27 @@ +# Update the PMDK documentation on pmem.io +name: pmem.io + +on: + workflow_dispatch: + push: + paths: + - 'doc/**' + +jobs: + doc_update: + if: github.ref_name == 'master' || startsWith(github.ref_name, 'stable-') + name: doc update + runs-on: ubuntu-latest + steps: + - name: Clone the git repo + uses: actions/checkout@v3 + + - name: Install dependencies + run: sudo apt-get install libndctl-dev libdaxctl-dev pandoc + + - name: Auto doc update + env: + DOC_UPDATE_GITHUB_TOKEN: ${{ secrets.DOC_UPDATE_GITHUB_TOKEN }} + TARGET_BRANCH: ${{ github.ref_name }} + WORKDIR: . + run: utils/run-doc-update.sh diff --git a/utils/docker/build-CI.sh b/utils/docker/build-CI.sh index 31543b2303d..670411fd61c 100755 --- a/utils/docker/build-CI.sh +++ b/utils/docker/build-CI.sh @@ -43,12 +43,6 @@ if [[ -f $CI_FILE_SKIP_BUILD_PKG_CHECK ]]; then BUILD_PACKAGE_CHECK=n; else BUIL if [ -z "$NDCTL_ENABLE" ]; then ndctl_enable=; else ndctl_enable="--env NDCTL_ENABLE=$NDCTL_ENABLE"; fi if [[ $UBSAN -eq 1 ]]; then for x in C CPP LD; do declare EXTRA_${x}FLAGS=-fsanitize=undefined; done; fi -# Only run auto doc update on push events on "upstream" repo -if [[ "${CI_EVENT_TYPE}" != "push" || "${CI_REPO_SLUG}" != "${GITHUB_REPO}" ]]; then - AUTO_DOC_UPDATE=0 - echo "Skipping auto doc update" -fi - # Check if we are running on a CI (GitHub Actions) [ -n "$GITHUB_ACTIONS" ] && CI_RUN="YES" || CI_RUN="NO" @@ -75,7 +69,6 @@ docker run --rm --name=$containerName -i \ $DNS_SETTING \ --env http_proxy=$http_proxy \ --env https_proxy=$https_proxy \ - --env AUTO_DOC_UPDATE=$AUTO_DOC_UPDATE \ --env CC=$PMDK_CC \ --env CXX=$PMDK_CXX \ --env VALGRIND=$VALGRIND \ diff --git a/utils/docker/run-build.sh b/utils/docker/run-build.sh index 754136831d4..df8f6552ab4 100755 --- a/utils/docker/run-build.sh +++ b/utils/docker/run-build.sh @@ -35,10 +35,3 @@ make -j1 pycheck echo "" echo "## Running make source" make -j$(nproc) DESTDIR=/tmp source - -# Create PR with generated docs -if [ "${AUTO_DOC_UPDATE}" == "1" ]; then - echo "" - echo "## Running auto doc update" - ./utils/docker/run-doc-update.sh -fi diff --git a/utils/docker/run-doc-update.sh b/utils/run-doc-update.sh similarity index 76% rename from utils/docker/run-doc-update.sh rename to utils/run-doc-update.sh index 25e40844f96..52e6fd32499 100755 --- a/utils/docker/run-doc-update.sh +++ b/utils/run-doc-update.sh @@ -3,9 +3,9 @@ # Copyright 2019-2023, Intel Corporation # -# run-doc-update.sh - is called inside a Docker container to build docs in the current repository, -# it checks if current branch is a 'valid' one (to only publish "merged" content, not from a PR), -# and it creates a pull request with an update of our docs (on 'main' branch of pmem.github.io repo). +# run-doc-update.sh - builds docs and creates a pull request with an update to +# the pmem.github.io repository. The only supported branches are master +# and stable-*. # set -e @@ -31,21 +31,19 @@ ARTIFACTS_DIR=$(mktemp -d -t ARTIFACTS-XXX) ORIGIN="https://${DOC_UPDATE_GITHUB_TOKEN}@github.com/${BOT_NAME}/${PAGES_REPO_NAME}" UPSTREAM="https://github.com/${USER_NAME}/${PAGES_REPO_NAME}" -# Only 'master' or 'stable-*' branches are valid; determine docs location dir on gh-pages branch -TARGET_BRANCH=${CI_BRANCH} -if [[ "${TARGET_BRANCH}" == "master" ]]; then +# Determine docs location dir on gh-pages branch +case $TARGET_BRANCH in +master) TARGET_DOCS_DIR="master" -elif [[ ${TARGET_BRANCH} == stable-* ]]; then + ;; +stable-*) TARGET_DOCS_DIR=v$(echo ${TARGET_BRANCH} | cut -d"-" -f2 -s) -else - echo "Skipping docs build, this script should be run only on master or stable-* branches." + ;; +*) + echo "ERROR: This script should be run only on master or stable-* branches." echo "TARGET_BRANCH is set to: \'${TARGET_BRANCH}\'." - exit 0 -fi -if [ -z "${TARGET_DOCS_DIR}" ]; then - echo "ERROR: Target docs location for branch: ${TARGET_BRANCH} is not set." exit 1 -fi +esac pushd ${WORKDIR}/doc echo "Build docs and copy man & web md"