diff --git a/.github/workflows/build_dev.yml b/.github/archived_workflows/build_dev.yml similarity index 87% rename from .github/workflows/build_dev.yml rename to .github/archived_workflows/build_dev.yml index a6df8bff7..ca5badffe 100644 --- a/.github/workflows/build_dev.yml +++ b/.github/archived_workflows/build_dev.yml @@ -16,7 +16,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: 3.x @@ -28,7 +28,7 @@ jobs: run: | mkdocs build -f mkdocs.yml -d site - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: development path: development/ @@ -37,7 +37,7 @@ jobs: run: | mkdir -p ./development_site mv site ./development_site/. - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: development_site path: development_site/ diff --git a/.github/workflows/deploy_dev.yml b/.github/archived_workflows/deploy_dev.yml similarity index 97% rename from .github/workflows/deploy_dev.yml rename to .github/archived_workflows/deploy_dev.yml index 5ca9d6ebb..d7f299382 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/archived_workflows/deploy_dev.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: 3.x diff --git a/.github/workflows/build_preview.yml b/.github/workflows/build_preview.yml index 8a928fc54..d2604c370 100644 --- a/.github/workflows/build_preview.yml +++ b/.github/workflows/build_preview.yml @@ -6,6 +6,7 @@ on: - opened - reopened - synchronize + - closed concurrency: group: preview-${{ github.ref }} @@ -13,12 +14,13 @@ concurrency: jobs: build-preview: + if: github.event.action != "closed" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: 3.x @@ -29,22 +31,71 @@ jobs: # builds to "site" directory by default run: | mkdocs build -f mkdocs.yml -d site - - - name: Save PR number - run: | - mkdir -p ./pr - echo ${{ github.event.number }} > ./pr/NB - - uses: actions/upload-artifact@v2 - with: - name: pr - path: pr/ - + - name: Save built site run: | mkdir -p ./pr_site mv site ./pr_site/. - - uses: actions/upload-artifact@v2 + + - uses: actions/upload-artifact@v3 with: name: pr_site path: pr_site/ + + deploy-preview: + needs: build-preview + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: "Download built site" + uses: actions/github-script@v3.1.0 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "pr_site" + })[0]; + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/pr_site.zip', Buffer.from(download.data)); + - run: unzip pr_site.zip + + - name: Deploy preview + uses: access-nri/pr-preview-action@v2.1.1 + with: + source-dir: site + action: deploy + pr-number: ${{ github.event.number }} + + close-preview: + if: github.event.action == "closed" + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: Clean preview + uses: access-nri/pr-preview-action@v2.1.1 + with: + action: remove + pr-number: ${{ github.event.number }} diff --git a/.github/workflows/check_links.yml b/.github/workflows/check_links.yml index 042382550..ed223b112 100644 --- a/.github/workflows/check_links.yml +++ b/.github/workflows/check_links.yml @@ -1,9 +1,15 @@ name: Check Markdown links -on: push +on: + push: + schedule: + # Run at 03:07 every Sunday + - cron: "7 3 * * SUN" + workflow_dispatch: jobs: markdown-link-check: + if: ${{ github.event_name != 'schedule' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -13,5 +19,19 @@ jobs: folder-path: 'docs' # Only check links in modified files to reduce false positives check-modified-files-only: 'yes' + use-quiet-mode: 'no' + use-verbose-mode: 'yes' + base-branch: 'main' + full-markdown-link-check: + if: ${{ github.event_name == 'schedule' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'no' + use-verbose-mode: 'yes' + config-file: '.github/workflows/mlc_config.json' + folder-path: 'docs' base-branch: 'main' \ No newline at end of file diff --git a/.github/workflows/clean_preview.yml b/.github/workflows/clean_preview.yml deleted file mode 100644 index 5b729dd5d..000000000 --- a/.github/workflows/clean_preview.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Clean PR preview - -on: - workflow_run: - workflows: ["Close PR"] - types: - - completed - -jobs: - close-preview: - runs-on: ubuntu-latest - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - steps: - - name: "Download PR number" - uses: actions/github-script@v3.1.0 - with: - script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "prnumber" - })[0]; - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/prnumber.zip', Buffer.from(download.data)); - - run: | - unzip prnumber.zip - echo "pr-number=$(cat prnumber.txt)" >> "$GITHUB_ENV" - shell: bash - - - name: Checkout - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 - with: - python-version: 3.x - - - name: Clean preview - uses: access-nri/pr-preview-action@v2.1.1 - with: - action: remove - pr-number: ${{ env.pr-number }} - diff --git a/.github/workflows/close_pr.yml b/.github/workflows/close_pr.yml deleted file mode 100644 index 4ce8a41a0..000000000 --- a/.github/workflows/close_pr.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Close PR - -on: - pull_request: - types: - - closed - -jobs: - send-number: - runs-on: ubuntu-latest - steps: - - name: Save PR number - run: | - mkdir -p ./prnumber - echo ${{ github.event.number }} > ./prnumber/prnumber.txt - - uses: actions/upload-artifact@v2 - with: - name: prnumber - path: prnumber/ - diff --git a/.github/workflows/deploy_preview.yml b/.github/workflows/deploy_preview.yml deleted file mode 100644 index cd8a83b41..000000000 --- a/.github/workflows/deploy_preview.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Deploy PR preview - -on: - workflow_run: - workflows: ["Build PR preview"] - types: - - completed - -jobs: - deploy-preview: - runs-on: ubuntu-latest - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - steps: - - name: Checkout - uses: actions/checkout@v3 - - - uses: actions/setup-python@v2 - with: - python-version: 3.x - - - name: "Download PR number" - uses: actions/github-script@v3.1.0 - with: - script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr" - })[0]; - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); - - run: | - unzip pr.zip - echo "pr-number=$(cat NB)" >> "$GITHUB_ENV" - shell: bash - - - name: "Download built site" - uses: actions/github-script@v3.1.0 - with: - script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr_site" - })[0]; - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/pr_site.zip', Buffer.from(download.data)); - - run: unzip pr_site.zip - - - name: Deploy preview - uses: access-nri/pr-preview-action@v2.1.1 - with: - source-dir: site - action: deploy - pr-number: ${{ env.pr-number }} - diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bc7842213..f5dbfd832 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,10 @@ -name: publish +name: Deploy ACCESS-Hive on: push: branches: - main + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: permissions: actions: write @@ -16,16 +18,23 @@ permissions: repository-projects: write security-events: write statuses: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false jobs: - deploy: + build: concurrency: ci-${{ github.ref }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: 3.x @@ -35,9 +44,31 @@ jobs: run: | mkdocs build -f mkdocs.yml -d site - - name: Deploy + - name: Deploy to gh-pagaes uses: JamesIves/github-pages-deploy-action@v4 with: folder: site branch: gh-pages # default - clean-exclude: pr-preview/ # don't overwrite previews \ No newline at end of file + clean-exclude: pr-preview/ # don't overwrite previews + + deploy: + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: 'gh-pages' + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + # Upload entire repository + path: '.' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/scheduled_link_check.yml b/.github/workflows/scheduled_link_check.yml deleted file mode 100644 index 4d9472b9f..000000000 --- a/.github/workflows/scheduled_link_check.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Full Check of markdown links - -on: - schedule: - # Run at 03:07 every Sunday - - cron: "7 3 * * Sun" - workflow_dispatch: - -jobs: - markdown-link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - use-quiet-mode: 'no' - use-verbose-mode: 'yes' - config-file: '.github/workflows/mlc_config.json' - folder-path: 'docs' - diff --git a/mkdocs.yml b/mkdocs.yml index 7c0302f94..4579245cf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -55,7 +55,7 @@ theme: icon: edit: material/pencil view: material/eye -copyright: Copyright © 2022 ACCESS-NRI +copyright: Copyright © 2023 ACCESS-NRI plugins: - git-revision-date-localized: