From 02c80d27638e9c1f76b1c0785b95a66bfc94fcb1 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Sun, 22 Dec 2024 17:09:38 +0000 Subject: [PATCH 1/2] serve mkdocs from github pages on deploy of api - allow option to push docs independently --- .../main_rcpch-nhs-organisations.yml | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main_rcpch-nhs-organisations.yml b/.github/workflows/main_rcpch-nhs-organisations.yml index fd72c6e..8d8a350 100644 --- a/.github/workflows/main_rcpch-nhs-organisations.yml +++ b/.github/workflows/main_rcpch-nhs-organisations.yml @@ -2,7 +2,7 @@ # More GitHub Actions for Azure: https://github.com/Azure/actions # More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions -name: Build and deploy Python app to Azure Web App - rcpch-nhs-organisations +name: Build and deploy Python app to Azure Web App - rcpch-nhs-organisations. Deploy docs to GitHub Pages on: push: @@ -33,3 +33,28 @@ jobs: app-name: "RCPCH-NHS-organisations" publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_A76B7421A08D44778EBB49AB30B51B3D }} package: "." + + deploy-mkdocs: + runs-on: ubuntu-latest + needs: build-and-deploy + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v1 + with: + python-version: "3.11" + + - name: Install MkDocs and dependencies + run: | + pip install mkdocs mkdocs-material + + - name: Build MkDocs site + run: mkdocs build --config-file documentation/mkdocs.yml + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./site From 6a6d61ab551a1207a87435e0bcf675bcacb23af2 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Sun, 22 Dec 2024 17:14:22 +0000 Subject: [PATCH 2/2] only fire on merge to live --- .../main_rcpch-nhs-organisations.yml | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main_rcpch-nhs-organisations.yml b/.github/workflows/main_rcpch-nhs-organisations.yml index 8d8a350..dbca259 100644 --- a/.github/workflows/main_rcpch-nhs-organisations.yml +++ b/.github/workflows/main_rcpch-nhs-organisations.yml @@ -5,13 +5,15 @@ name: Build and deploy Python app to Azure Web App - rcpch-nhs-organisations. Deploy docs to GitHub Pages on: - push: + pull_request: branches: - live - workflow_dispatch: + types: + - closed jobs: build-and-deploy: + if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: @@ -35,6 +37,7 @@ jobs: package: "." deploy-mkdocs: + if: github.event.pull_request.merged == true runs-on: ubuntu-latest needs: build-and-deploy @@ -58,3 +61,28 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./site + + deploy-mkdocs-only: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, '[docs]') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v1 + with: + python-version: "3.11" + + - name: Install MkDocs and dependencies + run: | + pip install mkdocs mkdocs-material + + - name: Build MkDocs site + run: mkdocs build --config-file documentation/mkdocs.yml + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./site