From f242ba7ab347f21590b2dbbe439b338cc67c52be Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 2 Jul 2020 22:19:17 +0200 Subject: [PATCH 1/4] Actions workflow for building and updating docs --- .github/workflows/docs.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..dd9938b6b --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,40 @@ +# This is a basic workflow to help you get started with Actions + +name: Update docs + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + runs-on: ubuntu-latest + steps: + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8.3 + + - uses: actions/checkout@v2 + + - name: Checkout docs + uses: actions/checkout@v2 + with: + repository: codeoverflow-org/nodecg-io-docs + path: ../nodecg-io-docs + token: ${{ github.token }} ###MUST BE CHANGED TO PAT + + - name: Build docs + run: python .scripts/build-docs.py + + - name: GitHub Push + uses: ad-m/github-push-action@v0.6.0 + with: + repository: codeoverflow-org/nodecg-io-docs + directory: ../nodecg-io-docs + github_token: ${{ github.token }} ###MUST BE CHANGED TO PAT From df636809874eae87fc7d4c1bc1288e0356f3eb7e Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 10 Jul 2020 23:01:58 +0200 Subject: [PATCH 2/4] Rework docs workflow * Added secret containing ssh deploy key * Reworked push mechanic to work with deploy keys --- .github/workflows/docs.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index dd9938b6b..6e9cb9a56 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -27,14 +27,16 @@ jobs: with: repository: codeoverflow-org/nodecg-io-docs path: ../nodecg-io-docs - token: ${{ github.token }} ###MUST BE CHANGED TO PAT + ssh-key: ${{ secret.DOCS_SSH_KEY }} - name: Build docs run: python .scripts/build-docs.py - name: GitHub Push - uses: ad-m/github-push-action@v0.6.0 - with: - repository: codeoverflow-org/nodecg-io-docs - directory: ../nodecg-io-docs - github_token: ${{ github.token }} ###MUST BE CHANGED TO PAT + run: | + cd ../nodecg-io-docs + git config --global user.email "<>" + git config --global user.name "codeoverflow-org" + git add . + git commit --message "Update generated documentation ( codeoverflow-org/nodecg-io@${{ github.sha }})" + git push --force origin master From d419b8dbb876f9c165181e78db30bf7495d99059 Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 10 Jul 2020 23:05:39 +0200 Subject: [PATCH 3/4] Remove unnecessary comments --- .github/workflows/docs.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6e9cb9a56..ffbc089b2 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,16 +1,11 @@ -# This is a basic workflow to help you get started with Actions name: Update docs -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch on: push: branches: [ master ] -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: runs-on: ubuntu-latest steps: From 448a3fbe16823c18fad37faaf239b14f79584ecc Mon Sep 17 00:00:00 2001 From: Jonas Date: Sat, 11 Jul 2020 10:01:59 +0200 Subject: [PATCH 4/4] Apply suggestions from code review * Fixed typo * Don't run workflow on fork Co-authored-by: Daniel Huber --- .github/workflows/docs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ffbc089b2..8120bd124 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,6 +8,7 @@ on: jobs: build: runs-on: ubuntu-latest + if: startsWith(github.repository, 'codeoverflow-org') # don't run this in forks steps: - name: Setup Python @@ -22,7 +23,7 @@ jobs: with: repository: codeoverflow-org/nodecg-io-docs path: ../nodecg-io-docs - ssh-key: ${{ secret.DOCS_SSH_KEY }} + ssh-key: ${{ secrets.DOCS_SSH_KEY }} - name: Build docs run: python .scripts/build-docs.py