From d18a264c171adba483d81904c9e2b05f9f8323c0 Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 16 Mar 2022 14:31:02 +0100 Subject: [PATCH 1/4] Use GitHub built-in mechanisms to cancel workflows --- .github/workflows/build-and-push-image.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-push-image.yaml b/.github/workflows/build-and-push-image.yaml index 28bbc028..7b204edf 100644 --- a/.github/workflows/build-and-push-image.yaml +++ b/.github/workflows/build-and-push-image.yaml @@ -8,6 +8,10 @@ env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build-and-push-image: runs-on: ubuntu-latest @@ -17,11 +21,6 @@ jobs: steps: - - name: Cancel previous builds if present - uses: n1hility/cancel-previous-runs@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout repository uses: actions/checkout@v2 @@ -45,4 +44,4 @@ jobs: file: ./.devcontainer/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} From 115bab63af05c7403a85b4919645e6404c3b6068 Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 16 Mar 2022 14:33:01 +0100 Subject: [PATCH 2/4] Use dedicated action to deploy on gh-pages --- .../build-and-publish-documentation.yaml | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-and-publish-documentation.yaml b/.github/workflows/build-and-publish-documentation.yaml index a9782aa6..b6d1403b 100644 --- a/.github/workflows/build-and-publish-documentation.yaml +++ b/.github/workflows/build-and-publish-documentation.yaml @@ -44,7 +44,7 @@ jobs: run: | rmarkdown::render("docs/real-time-method-comparison/index.Rmd") shell: Rscript {0} - + - name: Render paper run: | rmarkdown::render("writeup/paper.Rmd", output_dir = "docs") @@ -55,34 +55,10 @@ jobs: rmarkdown::render("writeup/si.Rmd", output_dir = "docs") shell: Rscript {0} - - name: Upload documentation - uses: actions/upload-artifact@v2 + - name: Deploy to GitHub pages 🚀 + uses: JamesIves/github-pages-deploy-action@4.1.4 with: - name: documentation - retention-days: 5 - path: docs - - publish-documentation: - if: github.ref == 'refs/heads/main' && github.repository == 'epiforecasts/eval-germany-sp-nowcasting' - needs: render-documentation - runs-on: macOS-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v2 - - name: Make a clean gh-pages branch - run: | - git checkout --orphan gh-pages - git rm -rf . - - uses: actions/download-artifact@v2 - with: - name: documentation - path: . - - name: Commit and push documentation - run: | - git config user.email "action@github.com" - git config user.name "GitHub Action - Published documentation" - git add --all - git commit -m "Published documentation" - git push -f origin gh-pages:gh-pages - echo "reports published to GitHub" + branch: gh-pages + folder: docs + single-commit: true + clean: true From 8851a66ec05700451617050f7e80110fd9590988 Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 23 Mar 2022 14:51:38 +0100 Subject: [PATCH 3/4] Deploy on main only --- .github/workflows/build-and-publish-documentation.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-publish-documentation.yaml b/.github/workflows/build-and-publish-documentation.yaml index b6d1403b..b5d347ea 100644 --- a/.github/workflows/build-and-publish-documentation.yaml +++ b/.github/workflows/build-and-publish-documentation.yaml @@ -56,6 +56,7 @@ jobs: shell: Rscript {0} - name: Deploy to GitHub pages 🚀 + if: github.ref == 'refs/heads/main' uses: JamesIves/github-pages-deploy-action@4.1.4 with: branch: gh-pages From 385514f503997b2d0de7cd5b3fd3f629f7a8405f Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 23 Mar 2022 14:51:45 +0100 Subject: [PATCH 4/4] Upload artifact --- .github/workflows/build-and-publish-documentation.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-and-publish-documentation.yaml b/.github/workflows/build-and-publish-documentation.yaml index b5d347ea..698f9b9e 100644 --- a/.github/workflows/build-and-publish-documentation.yaml +++ b/.github/workflows/build-and-publish-documentation.yaml @@ -55,6 +55,13 @@ jobs: rmarkdown::render("writeup/si.Rmd", output_dir = "docs") shell: Rscript {0} + - name: Upload documentation + uses: actions/upload-artifact@v2 + with: + name: documentation + retention-days: 5 + path: docs + - name: Deploy to GitHub pages 🚀 if: github.ref == 'refs/heads/main' uses: JamesIves/github-pages-deploy-action@4.1.4