From 9d159a3348df84ddc17b39719f60e818105c26db Mon Sep 17 00:00:00 2001 From: Paul Albertella Date: Sun, 10 Nov 2024 15:29:15 +0000 Subject: [PATCH] Add mkdocs publish support Signed-off-by: Paul Albertella --- .github/workflows/deploy.yml | 73 ++++++++++ .github/workflows/main.yml | 44 ------ .github/workflows/pr-close.yml | 34 +++++ docs/CNAME | 1 + docs/images/elisa-horizontal-color.svg | 190 +++++++++++++++++++++++++ docs/images/elisa-logo.svg | 72 ++++++++++ docs/images/favicon.ico | Bin 0 -> 4314 bytes docs/index.md | 18 +++ docs/requirements.txt | 4 + docs/stylesheets/elisa.css | 47 ++++++ mkdocs.yml | 39 +++++ 11 files changed, 478 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/pr-close.yml create mode 100644 docs/CNAME create mode 100644 docs/images/elisa-horizontal-color.svg create mode 100644 docs/images/elisa-logo.svg create mode 100644 docs/images/favicon.ico create mode 100644 docs/index.md create mode 100644 docs/requirements.txt create mode 100644 docs/stylesheets/elisa.css create mode 100644 mkdocs.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..0c49d64 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,73 @@ +# Workflow to build and deploy to GitHub Pages, with previews for PRs +# Based on https://github.com/daiyi/gh-pages-pr-previews + +name: github pages + +on: + push: + branches: + - main + pull_request: + +jobs: + deploy: + runs-on: ubuntu-20.04 + env: + PR_PATH: pull/${{github.event.number}} + steps: + - name: Comment on PR + uses: hasura/comment-progress@v2.2.0 + if: github.ref != 'refs/heads/main' + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + number: ${{ github.event.number }} + id: deploy-preview + message: "Starting deployment of preview ⏳..." + + - name: Set domain + run: echo "DOMAIN=osep.elisa.tech" >> $GITHUB_ENV + + - name: Set base URL for preview if PR + if: github.ref != 'refs/heads/main' + run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV + + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: 3.x + + - name: Checkout the triggering ref + uses: actions/checkout@v4 + + - name: Build site + run: | + pip install -r docs/requirements.txt + mkdocs build + + - name: Deploy if this is the `main` branch + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + cname: ${{ env.DOMAIN }} + + - name: Deploy to PR preview + uses: peaceiris/actions-gh-pages@v3 + if: github.ref != 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + destination_dir: ${{ env.PR_PATH }} + keep_files: true + + - name: Update comment + uses: hasura/comment-progress@v2.2.0 + if: github.ref != 'refs/heads/main' + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + number: ${{ github.event.number }} + id: deploy-preview + message: "A preview of ${{ github.event.after }} is here:\n\n ✨ ${{ env.BASE_URL }}" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index bae05ab..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: CI - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the main branch - push: - branches: [ main ] - pull_request: - branches: [ main ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - env: - STPATOOLS_VERSION: "42e07abc5510f5864aa102aa7ae1e8349911a620" - STPATOOLS_REPO: "https://gitlab.com/CodethinkLabs/stpatools.git" - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - # Check that YAML files are well-formed - - name: YAML lint - run: yamllint -d relaxed . - - # Install specific version of ruamel.yaml required by STPAtools - - name: Install ruamel.yaml - run: pip3 install ruamel.yaml==0.16.7 - - # Install specific version of STPA tools from repo - - name: Install STPA tools - run: pip3 install "git+${{env.STPATOOLS_REPO}}@${{env.STPATOOLS_VERSION}}" - - # Validate STPA files - - name: Validate STPA files (STPA_DynMA) - run: stpa-validate STPA_DynMA/*.yml diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml new file mode 100644 index 0000000..c508d2d --- /dev/null +++ b/.github/workflows/pr-close.yml @@ -0,0 +1,34 @@ +# Workflow to clean up PR previews +# Based on https://github.com/daiyi/gh-pages-pr-previews + +name: delete preview on PR close + +# only trigger on pull request closed events +on: + pull_request: + types: [closed] + +jobs: + delete_preview: + runs-on: ubuntu-20.04 + env: + PR_PATH: pull/${{github.event.number}} + steps: + - name: make empty dir + run: mkdir public + + - name: delete folder + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + destination_dir: ${{ env.PR_PATH }} + + - name: Comment on PR + uses: hasura/comment-progress@v2.2.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + number: ${{ github.event.number }} + id: deploy-preview + message: "🪓 PR closed, deleted preview content from gh-pages" diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..09c6e78 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +osep.elisa.tech diff --git a/docs/images/elisa-horizontal-color.svg b/docs/images/elisa-horizontal-color.svg new file mode 100644 index 0000000..1c058e1 --- /dev/null +++ b/docs/images/elisa-horizontal-color.svg @@ -0,0 +1,190 @@ + + diff --git a/docs/images/elisa-logo.svg b/docs/images/elisa-logo.svg new file mode 100644 index 0000000..e6048c7 --- /dev/null +++ b/docs/images/elisa-logo.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + diff --git a/docs/images/favicon.ico b/docs/images/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..978b94d6ec1de25ee49aa3ecc8c33b018b362347 GIT binary patch literal 4314 zcmdtjOGs2v9LMoHV>X(aW2KTk&}<1U$jX@Yi(Ssh4 zVP#bGz>G?W5=nw=5fVKu7r9ZW)E>0z`;&WyGjm7Bblhlsx@XSg|3CMfbMJK=AOCW5 z9sTb#1sx~Lahw8BE}{#sp?l4M)1`9C8+z;ghcJw3ex0nmhJgG~@F(~(AG(&5=4@o9gH+_bkpBUQvtI+w^ z`}mGq)>;JZe350^GqZ(A+5Ny{)y- zH|RD(?;^_DuWamvzQ3PQs9e$hXiLBn+=SvaVhuds3wu26I(s`&ibS<>)x0#e35und zix8T-9m6iuNAJ1yXomK>78)CM-Q0YB+C_V`7}ue(&#?}vc8*wO`fKfSP=PjdK;PFH z2-_3IQXOWZ3hMh2<(Ldl|5*7=J7cvcdgjie3$54%y?>Nb^zAFd8+76nW+CQUn>?|u z#L{^$Mm@Bj4cLH<(EC7jby$u-taw9dC$8>Q?|`jnK@Ym|5?hdtA+Pmd=cF9a*(h