From 8ebb4180d6fed5bd5adfdc90b4628b7020b66bc9 Mon Sep 17 00:00:00 2001 From: Gopi Krishna Menon Date: Tue, 9 Mar 2021 23:30:18 +0530 Subject: [PATCH] Updated Docs Workflow to publish with peaceiris/action-gh-pages --- .github/actions/generate-doc/action.yml | 13 ++++++++++++ .../docs-config.sh} | 20 ++++++------------- .../actions/generate-publish-doc/action.yml | 17 ---------------- .github/workflows/docs.yaml | 7 ++++++- 4 files changed, 25 insertions(+), 32 deletions(-) create mode 100644 .github/actions/generate-doc/action.yml rename .github/actions/{generate-publish-doc/upload-script.sh => generate-doc/docs-config.sh} (51%) delete mode 100644 .github/actions/generate-publish-doc/action.yml diff --git a/.github/actions/generate-doc/action.yml b/.github/actions/generate-doc/action.yml new file mode 100644 index 0000000000..3ab8995f32 --- /dev/null +++ b/.github/actions/generate-doc/action.yml @@ -0,0 +1,13 @@ +name: 'Generate Doc' +description: 'Runs b2 on lib/gil/doc to generate documentation' +runs: + using: composite + steps: + - run: | + echo "using doxygen ;" > ~/user-config.jam + cd ../boost-root/libs + ../b2 gil/doc + cd gil + chmod +x $GITHUB_WORKSPACE/.github/actions/generate-doc/docs-config.sh + $GITHUB_WORKSPACE/.github/actions/generate-doc/docs-config.sh + shell: bash diff --git a/.github/actions/generate-publish-doc/upload-script.sh b/.github/actions/generate-doc/docs-config.sh similarity index 51% rename from .github/actions/generate-publish-doc/upload-script.sh rename to .github/actions/generate-doc/docs-config.sh index 6883c198fc..695d6d0eb0 100644 --- a/.github/actions/generate-publish-doc/upload-script.sh +++ b/.github/actions/generate-doc/docs-config.sh @@ -1,40 +1,32 @@ #!/bin/bash set -e # Exit with Non Zero exit Code -# Save some useful information -SHA=`git rev-parse --verify HEAD` - mkdir temp-doc cd temp-doc + git init -git config user.name "Github Action Upload Docs" -git config user.email "Github Action Upload Docs" -git remote add upstream "https://$1@github.com/boostorg/gil.git" +git remote add upstream "https://github.com/boostorg/gil.git" git fetch upstream git switch gh-pages if [ "${GITHUB_REF##*/}" = develop ]; then + # Only updates develop directory and keeps others intact rm -r develop mkdir -p develop/doc cp ../index.html develop/ cp ../doc/index.html develop/doc cp -a ../doc/html develop/doc/ else + # main branch rm index.html rm -r html cp ../doc/index.html . cp -r ../doc/html . fi - -git add . - -# Commit the new version. -git commit -m "Deploy to GitHub Pages: ${SHA}" - -# Now that we're all set up, we can push. -git push -q upstream HEAD:gh-pages +# Remove version control +rm -rf .git \ No newline at end of file diff --git a/.github/actions/generate-publish-doc/action.yml b/.github/actions/generate-publish-doc/action.yml deleted file mode 100644 index d794f43e59..0000000000 --- a/.github/actions/generate-publish-doc/action.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: 'Generate Doc' -description: 'Runs b2 on lib/gil/doc to generate documentation' -inputs: - github_token: - description: 'Github Token for Access' - required: true -runs: - using: composite - steps: - - run: | - echo "using doxygen ;" > ~/user-config.jam - cd ../boost-root/libs - ../b2 gil/doc - cd gil - chmod +x $GITHUB_WORKSPACE/.github/actions/generate-publish-doc/upload-script.sh - $GITHUB_WORKSPACE/.github/actions/generate-publish-doc/upload-script.sh ${{inputs.github_token}} - shell: bash diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 171f44e7f5..9a20e7c55f 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -12,6 +12,11 @@ jobs: - uses: actions/checkout@v2 - uses: ./.github/actions/docs-prerequisites - uses: ./.github/actions/setup-boost - - uses: ./.github/actions/generate-publish-doc + - uses: ./.github/actions/generate-doc + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ../boost-root/libs/gil/temp-doc + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com'