From 7a0b8fe2f74f3668f5e2f0fede7ed8a7b064ea53 Mon Sep 17 00:00:00 2001 From: anchit-chandran Date: Tue, 9 Apr 2024 10:59:27 +0100 Subject: [PATCH] Add GitHub Actions workflows for automatic issue/project management and Azure deployment Signed-off-by: anchit-chandran --- .../workflows/all-branches-and-PRs-test.yml | 4 ++-- .../workflows/auto-add-issues-to-project.yml | 2 +- .../workflows/create-hazard-log-labels.yml | 4 ++-- .../docs-all-PRs-build-deploy-to-azure.yml | 20 +++++++++---------- .../.github => .github/workflows}/labels.yml | 0 ...-hazard-reply-with-hazard-instructions.yml | 2 +- ...rcpch-dgc-server-live-deploy-to-azure.yml} | 0 ...ch-dgc-server-staging-deploy-to-azure.yml} | 6 +++--- 8 files changed, 19 insertions(+), 19 deletions(-) rename {documentation/.github => .github}/workflows/auto-add-issues-to-project.yml (85%) rename {documentation/.github => .github}/workflows/create-hazard-log-labels.yml (79%) rename documentation/.github/workflows/ALL-BRANCHES-ALL-PRs-build-and-deploy-to-azure.yml => .github/workflows/docs-all-PRs-build-deploy-to-azure.yml (78%) rename {documentation/.github => .github/workflows}/labels.yml (100%) rename {documentation/.github => .github}/workflows/on-issue-labelled-hazard-reply-with-hazard-instructions.yml (89%) rename .github/workflows/{live_rcpch-dgc-server-live.yml => rcpch-dgc-server-live-deploy-to-azure.yml} (100%) rename .github/workflows/{staging_rcpch-dgc-server-staging.yml => rcpch-dgc-server-staging-deploy-to-azure.yml} (87%) diff --git a/.github/workflows/all-branches-and-PRs-test.yml b/.github/workflows/all-branches-and-PRs-test.yml index 64363b36..a4f8c679 100644 --- a/.github/workflows/all-branches-and-PRs-test.yml +++ b/.github/workflows/all-branches-and-PRs-test.yml @@ -18,10 +18,10 @@ jobs: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v4 # latest as at February 2024 + - uses: actions/checkout@v4 # latest as at Apr 2024 - name: Set up Python version ${{ matrix.python-version }} - uses: actions/setup-python@v5 # latest as at March 2024 + uses: actions/setup-python@v5 # latest as at Apr 2024 with: python-version: ${{ matrix.python-version }} diff --git a/documentation/.github/workflows/auto-add-issues-to-project.yml b/.github/workflows/auto-add-issues-to-project.yml similarity index 85% rename from documentation/.github/workflows/auto-add-issues-to-project.yml rename to .github/workflows/auto-add-issues-to-project.yml index cda67806..668387a9 100644 --- a/documentation/.github/workflows/auto-add-issues-to-project.yml +++ b/.github/workflows/auto-add-issues-to-project.yml @@ -13,7 +13,7 @@ jobs: name: Add issue or PR to project automatically runs-on: ubuntu-latest steps: - - uses: actions/add-to-project@v0.4.0 + - uses: actions/add-to-project@v1.0.0 # latest as at April 2024 with: project-url: https://github.com/orgs/rcpch/projects/5 #dGC Project github-token: ${{ secrets.AUTO_ADD_TO_PROJECT_TOKEN }} diff --git a/documentation/.github/workflows/create-hazard-log-labels.yml b/.github/workflows/create-hazard-log-labels.yml similarity index 79% rename from documentation/.github/workflows/create-hazard-log-labels.yml rename to .github/workflows/create-hazard-log-labels.yml index 1edb722b..703ee178 100644 --- a/documentation/.github/workflows/create-hazard-log-labels.yml +++ b/.github/workflows/create-hazard-log-labels.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Latest as at April 2024 - name: Run Labeller if: success() - uses: crazy-max/ghaction-github-labeler@v4 + uses: crazy-max/ghaction-github-labeler@v5 # Latest as at April 2024 with: github-token: ${{ secrets.GITHUB_TOKEN }} yaml-file: .github/labels.yml diff --git a/documentation/.github/workflows/ALL-BRANCHES-ALL-PRs-build-and-deploy-to-azure.yml b/.github/workflows/docs-all-PRs-build-deploy-to-azure.yml similarity index 78% rename from documentation/.github/workflows/ALL-BRANCHES-ALL-PRs-build-and-deploy-to-azure.yml rename to .github/workflows/docs-all-PRs-build-deploy-to-azure.yml index aa21eb0b..1ee7dc67 100644 --- a/documentation/.github/workflows/ALL-BRANCHES-ALL-PRs-build-and-deploy-to-azure.yml +++ b/.github/workflows/docs-all-PRs-build-deploy-to-azure.yml @@ -2,7 +2,7 @@ # and pushes it to Azure from where it is deployed # to the LIVE site https://growth.rcpch.ac.uk/ # -# Azure will also build a preview site for any PRs against LIVE or branches +# Azure will also build a preview site for any branches and any PRs against `live`. name: ALL-BRANCHES-ALL-PRs-build-and-deploy-to-azure.yml @@ -27,19 +27,18 @@ jobs: ENABLE_GIT_COMMITTERS: True # Makes git-committers an option, default disabled, when building locally name: Build and Deploy to Azure steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # latest as at Apr 2024 with: fetch-depth: 0 # required for git-revision and git-committers plugins to work properly in CI submodules: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@5 # latest as at Apr 2024 with: - python-version: '3.11' - #- run: pip install git+https://${{ secrets.MATERIAL_FOR_MKDOCS_ACCESS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git - - run: pip install -r requirements.txt - - run: mkdocs build + python-version: '3.12' + - run: pip install -r documentation/docs-requirements.txt + - run: mkdocs build --config-file documentation/mkdocs.yml - name: Upload to Azure id: builddeploy - uses: Azure/static-web-apps-deploy@v1 + uses: Azure/static-web-apps-deploy@v1 # latest as at Apr 2024 with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_GLACIER_063C32703 }} repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments) @@ -50,7 +49,8 @@ jobs: api_location: "" # Api source code path relative to repository root - optional output_location: "site" # Built app content directory, relative to app_location - optional ###### End of Repository/Build Configurations ###### - + + # Deletes temporary deployment on Azure when PR is closed, therefore no longer needed. close_pull_request_job: if: github.event_name == 'pull_request' && github.event.action == 'closed' runs-on: ubuntu-latest @@ -58,7 +58,7 @@ jobs: steps: - name: Close Pull Request id: closepullrequest - uses: Azure/static-web-apps-deploy@v1 + uses: Azure/static-web-apps-deploy@v1 # latest as at Apr 2024 with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_GLACIER_063C32703 }} action: "close" diff --git a/documentation/.github/labels.yml b/.github/workflows/labels.yml similarity index 100% rename from documentation/.github/labels.yml rename to .github/workflows/labels.yml diff --git a/documentation/.github/workflows/on-issue-labelled-hazard-reply-with-hazard-instructions.yml b/.github/workflows/on-issue-labelled-hazard-reply-with-hazard-instructions.yml similarity index 89% rename from documentation/.github/workflows/on-issue-labelled-hazard-reply-with-hazard-instructions.yml rename to .github/workflows/on-issue-labelled-hazard-reply-with-hazard-instructions.yml index 71d6fdcf..310a9b3f 100644 --- a/documentation/.github/workflows/on-issue-labelled-hazard-reply-with-hazard-instructions.yml +++ b/.github/workflows/on-issue-labelled-hazard-reply-with-hazard-instructions.yml @@ -11,7 +11,7 @@ jobs: issues: write steps: - name: Add comment - uses: peter-evans/create-or-update-comment@v1 + uses: peter-evans/create-or-update-comment@v4 # Latest as at April 2024 with: issue-number: ${{ github.event.issue.number }} body: | diff --git a/.github/workflows/live_rcpch-dgc-server-live.yml b/.github/workflows/rcpch-dgc-server-live-deploy-to-azure.yml similarity index 100% rename from .github/workflows/live_rcpch-dgc-server-live.yml rename to .github/workflows/rcpch-dgc-server-live-deploy-to-azure.yml diff --git a/.github/workflows/staging_rcpch-dgc-server-staging.yml b/.github/workflows/rcpch-dgc-server-staging-deploy-to-azure.yml similarity index 87% rename from .github/workflows/staging_rcpch-dgc-server-staging.yml rename to .github/workflows/rcpch-dgc-server-staging-deploy-to-azure.yml index ab737656..52e6a3a7 100644 --- a/.github/workflows/staging_rcpch-dgc-server-staging.yml +++ b/.github/workflows/rcpch-dgc-server-staging-deploy-to-azure.yml @@ -15,10 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 # latest as at March 2024 + - uses: actions/checkout@v4 # latest as at April 2024 - name: Set up Python version - uses: actions/setup-python@v5 # latest as at March 2024 + uses: actions/setup-python@v5 # latest as at April 2024 with: python-version: '3.12' @@ -36,7 +36,7 @@ jobs: run: zip release.zip ./* -r - name: Upload artifact for deployment jobs - uses: actions/upload-artifact@v4 # latest as at March 2024 + uses: actions/upload-artifact@v4 # latest as at April 2024 with: name: python-app path: |