From 5cb84c02d437ba0ba78f6f4bee7d75def7e23f81 Mon Sep 17 00:00:00 2001 From: Richard North Date: Sat, 30 Nov 2019 11:24:37 +0000 Subject: [PATCH 1/6] Add GitHub action to automatically update docs version --- .github/workflows/update-docs-version.yml | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/update-docs-version.yml diff --git a/.github/workflows/update-docs-version.yml b/.github/workflows/update-docs-version.yml new file mode 100644 index 00000000000..b0196eca500 --- /dev/null +++ b/.github/workflows/update-docs-version.yml @@ -0,0 +1,29 @@ +name: Update docs version + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v1 + - uses: webfactory/ssh-agent@ea39f521c5e59e2e0a73686497d303bb2b499e03 # v0.1.1 + with: + ssh-private-key: ${{ secrets.github_deploy_key_for_update_docs_action }} + - name: Update latest_version property in mkdocs.yml + run: | + sed -i "s/latest_version: .*/latest_version: ${GITHUB_REF##*/}/g" mkdocs.yml + - name: Commit and push changes + env: + COMMIT_MSG: | + Update documentation version to ${GITHUB_REF##*/} + skip-checks: true + run: | + git config user.email "nobody@testcontainers.org" + git config user.name "GitHub Action - Update docs version" + git checkout master + git add . + # Only commit and push if we have changes + git diff && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin master) From 36c8b17a972ed64cbb165e7d5adacee03086a2b2 Mon Sep 17 00:00:00 2001 From: Richard North Date: Sat, 30 Nov 2019 11:26:09 +0000 Subject: [PATCH 2/6] Fix syntax error --- .github/workflows/update-docs-version.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-docs-version.yml b/.github/workflows/update-docs-version.yml index b0196eca500..62f37a2c910 100644 --- a/.github/workflows/update-docs-version.yml +++ b/.github/workflows/update-docs-version.yml @@ -9,7 +9,8 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 - - uses: webfactory/ssh-agent@ea39f521c5e59e2e0a73686497d303bb2b499e03 # v0.1.1 + - uses: webfactory/ssh-agent@ea39f521c5e59e2e0a73686497d303bb2b499e03 + # ^ v0.1.1 with: ssh-private-key: ${{ secrets.github_deploy_key_for_update_docs_action }} - name: Update latest_version property in mkdocs.yml From f7586569d55a34b7c92bd111f009468ef5baa61d Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 1 Dec 2019 17:09:54 +0000 Subject: [PATCH 3/6] Update update-docs-version.yml --- .github/workflows/update-docs-version.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-docs-version.yml b/.github/workflows/update-docs-version.yml index 62f37a2c910..0884f43143e 100644 --- a/.github/workflows/update-docs-version.yml +++ b/.github/workflows/update-docs-version.yml @@ -9,10 +9,9 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 - - uses: webfactory/ssh-agent@ea39f521c5e59e2e0a73686497d303bb2b499e03 - # ^ v0.1.1 - with: - ssh-private-key: ${{ secrets.github_deploy_key_for_update_docs_action }} + - uses: webfactory/ssh-agent@ea39f521c5e59e2e0a73686497d303bb2b499e03 # v0.1.1 + with: + ssh-private-key: ${{ secrets.github_deploy_key_for_update_docs_action }} - name: Update latest_version property in mkdocs.yml run: | sed -i "s/latest_version: .*/latest_version: ${GITHUB_REF##*/}/g" mkdocs.yml From 86782d5b4c1a6c5e7d5e129e60291ddf0bb9d1a7 Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 1 Dec 2019 17:10:17 +0000 Subject: [PATCH 4/6] Update update-docs-version.yml --- .github/workflows/update-docs-version.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-docs-version.yml b/.github/workflows/update-docs-version.yml index 0884f43143e..25d0d7fddea 100644 --- a/.github/workflows/update-docs-version.yml +++ b/.github/workflows/update-docs-version.yml @@ -16,11 +16,11 @@ jobs: run: | sed -i "s/latest_version: .*/latest_version: ${GITHUB_REF##*/}/g" mkdocs.yml - name: Commit and push changes - env: - COMMIT_MSG: | + env: + COMMIT_MSG: | Update documentation version to ${GITHUB_REF##*/} skip-checks: true - run: | + run: | git config user.email "nobody@testcontainers.org" git config user.name "GitHub Action - Update docs version" git checkout master From 5ae3bda78a6b1198a5ef6e31a5ab2bfd84d4655c Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 1 Dec 2019 20:52:43 +0000 Subject: [PATCH 5/6] Use ad-m/github-push-action --- .github/workflows/update-docs-version.yml | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/update-docs-version.yml b/.github/workflows/update-docs-version.yml index 25d0d7fddea..e8254d128ea 100644 --- a/.github/workflows/update-docs-version.yml +++ b/.github/workflows/update-docs-version.yml @@ -9,21 +9,22 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 - - uses: webfactory/ssh-agent@ea39f521c5e59e2e0a73686497d303bb2b499e03 # v0.1.1 - with: - ssh-private-key: ${{ secrets.github_deploy_key_for_update_docs_action }} - name: Update latest_version property in mkdocs.yml run: | sed -i "s/latest_version: .*/latest_version: ${GITHUB_REF##*/}/g" mkdocs.yml - - name: Commit and push changes + - name: Commit changes env: COMMIT_MSG: | - Update documentation version to ${GITHUB_REF##*/} - skip-checks: true + Update documentation version to ${GITHUB_REF##*/} + skip-checks: true run: | - git config user.email "nobody@testcontainers.org" - git config user.name "GitHub Action - Update docs version" - git checkout master - git add . - # Only commit and push if we have changes - git diff && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin master) + git config user.email "nobody@testcontainers.org" + git config user.name "GitHub Action - Update docs version" + git checkout master + git add . + # Only commit and push if we have changes + git diff && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}") + - name: Push changes + uses: ad-m/github-push-action@68af9897f2b021035ca3952bf354bbb4675c1762 # v0.5.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} From 0054876c7118e159e5268760fb116caece72a45e Mon Sep 17 00:00:00 2001 From: Richard North Date: Sat, 7 Dec 2019 14:23:45 +0000 Subject: [PATCH 6/6] Updates following review --- .github/workflows/update-docs-version.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/update-docs-version.yml b/.github/workflows/update-docs-version.yml index e8254d128ea..ad8773db2db 100644 --- a/.github/workflows/update-docs-version.yml +++ b/.github/workflows/update-docs-version.yml @@ -9,21 +9,18 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 + - name: Checkout master + run: git checkout master - name: Update latest_version property in mkdocs.yml run: | sed -i "s/latest_version: .*/latest_version: ${GITHUB_REF##*/}/g" mkdocs.yml + git diff - name: Commit changes - env: - COMMIT_MSG: | - Update documentation version to ${GITHUB_REF##*/} - skip-checks: true run: | git config user.email "nobody@testcontainers.org" git config user.name "GitHub Action - Update docs version" - git checkout master - git add . - # Only commit and push if we have changes - git diff && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}") + git add mkdocs.yml + git commit -m "Update documentation version to ${GITHUB_REF##*/}" -m "skip-checks: true" || echo "not changed" - name: Push changes uses: ad-m/github-push-action@68af9897f2b021035ca3952bf354bbb4675c1762 # v0.5.0 with: