From 9eef65713f5468a1a10fb13499620a9bf05e30ae Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 16 Apr 2020 20:23:23 +0530 Subject: [PATCH 1/4] Add a workflow to build and deploy docs site --- .github/actions/deploy_docs | 23 +++++++++++++++++++++++ .github/workflows/deploy_docs.yml | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/actions/deploy_docs create mode 100644 .github/workflows/deploy_docs.yml diff --git a/.github/actions/deploy_docs b/.github/actions/deploy_docs new file mode 100644 index 00000000000..85d640cea1c --- /dev/null +++ b/.github/actions/deploy_docs @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +bundle exec jekyll build -s docs -d docs/_site -Vt +cd docs/_site +touch .nojekyll +remote_branch="gh-pages-trial" + +echo "Publishing to ${GITHUB_REPOSITORY} on branch ${remote_branch}" +remote_repo="https://${JEKYLL_PAT}@github.com/${GITHUB_REPOSITORY}.git" + +git init -q +git config user.name "${GITHUB_ACTOR}" +git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" +git add . +git commit -qm "[GH ACTIONS] Build triggered by ${GITHUB_SHA}" + +echo "" +git push --force $remote_repo master:$remote_branch + +cd ../.. +exit 0 diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml new file mode 100644 index 00000000000..22ba47339e9 --- /dev/null +++ b/.github/workflows/deploy_docs.yml @@ -0,0 +1,22 @@ +name: Build and deploy Jekyll documentation site +on: + pull_request: + branches: + - master +jobs: + deploy_docs: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + runs-on: 'ubuntu-latest' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-ruby@v1 + with: + ruby-version: 2.7.x + - name: Set up dependencies + run: gem update --system --no-document + run: gem update bundler --no-document + run: bundle install --jobs 4 --retry 3 + - name: Build and Deploy + run: bash .github/actions/deploy_docs + env: + JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }} From 88c3e8362e736ed606ea54d27ff525f0e9ef4e51 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 16 Apr 2020 20:40:16 +0530 Subject: [PATCH 2/4] Bootstrap action environment with a shell script --- .github/actions/bootstrap | 7 +++++++ .github/workflows/deploy_docs.yml | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .github/actions/bootstrap diff --git a/.github/actions/bootstrap b/.github/actions/bootstrap new file mode 100644 index 00000000000..d28586fa09d --- /dev/null +++ b/.github/actions/bootstrap @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +gem update --system --no-document +gem update bundler --no-document +bundle install --jobs 4 --retry 3 diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 22ba47339e9..7d3942c5134 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -13,9 +13,7 @@ jobs: with: ruby-version: 2.7.x - name: Set up dependencies - run: gem update --system --no-document - run: gem update bundler --no-document - run: bundle install --jobs 4 --retry 3 + run: bash .github/actions/bootstrap - name: Build and Deploy run: bash .github/actions/deploy_docs env: From aed01498ecb6c2feecf484c2546af22d830ab0f6 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Fri, 22 May 2020 21:10:12 +0530 Subject: [PATCH 3/4] Use GITHUB_TOKEN as access-token --- .github/workflows/deploy_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 7d3942c5134..1b05b2d6e95 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -17,4 +17,4 @@ jobs: - name: Build and Deploy run: bash .github/actions/deploy_docs env: - JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }} + JEKYLL_PAT: ${{ secrets.GITHUB_TOKEN }} From d0c82100bc458094b388a01871faf2b93f1148c8 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Fri, 22 May 2020 21:58:54 +0530 Subject: [PATCH 4/4] Attempt using token directly [skip ci] --- .github/actions/deploy_docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy_docs b/.github/actions/deploy_docs index 85d640cea1c..48c6f7677ec 100644 --- a/.github/actions/deploy_docs +++ b/.github/actions/deploy_docs @@ -8,7 +8,7 @@ touch .nojekyll remote_branch="gh-pages-trial" echo "Publishing to ${GITHUB_REPOSITORY} on branch ${remote_branch}" -remote_repo="https://${JEKYLL_PAT}@github.com/${GITHUB_REPOSITORY}.git" +remote_repo="https://x-access-token:${JEKYLL_PAT}@github.com/${GITHUB_REPOSITORY}.git" git init -q git config user.name "${GITHUB_ACTOR}"