Skip to content

Commit

Permalink
Add mkdocs publish support
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Albertella <[email protected]>
  • Loading branch information
reiterative committed Nov 10, 2024
1 parent 2f31160 commit 9d159a3
Show file tree
Hide file tree
Showing 11 changed files with 478 additions and 44 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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 }}"
44 changes: 0 additions & 44 deletions .github/workflows/main.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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"
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
osep.elisa.tech
190 changes: 190 additions & 0 deletions docs/images/elisa-horizontal-color.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions docs/images/elisa-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/favicon.ico
Binary file not shown.
18 changes: 18 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
![ELISA - Enabling Linux in Safety Applications](images/elisa-horizontal-color.svg){: .elisa-title-image }

# Welcome to OSEP

This is the home of the **Open Source Engineering Process (OSEP)** working
group, part of the Linux Foundation's [ELISA](https://elisa.tech/) project

This working group examines how software engineering processes can be used to
facilitate the certification of safety-related systems incorporating Linux and
other FOSS. We consider the roles that a Linux-based OS might have in such
systems; how FOSS developers, system integrators and product creators can
specify these roles; and the evidence they might need to provide to support
associated safety arguments.

Use the menu on the left to navigate within the site, and the _Table of
contents_ on the right to browse within a page. Alternatively, type what you
are looking for in the _Search_ box above.

4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mkdocs==1.6.0
mkdocs-material==9.5.22
mkdocs-material-extensions==1.3.1
pymdown-extensions==10.12
47 changes: 47 additions & 0 deletions docs/stylesheets/elisa.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
:root {

--elisa-green: #77c046;

--md-default-fg-color: slategrey;
--md-default-bg-color: white;

--md-primary-fg-color: black;
--md-primary-bg-color: var(--elisa-green);

--md-typeset-a-color: darkgreen;
--md-accent-fg-color: var(--elisa-green);

}

.md-typeset__table {
min-width: 100%;
}

.md-typeset table:not([class]) {
display: table;
border: none;
}

td {
background-color: #f0f0f0;
margin: 2px;
}

th {
background-color: darkgreen;
color: var(--elisa-green);
}

th:first-child {
border-top-left-radius: 10px;
}

th:last-child {
border-top-right-radius: 10px;
}

.elisa-title-image {
width: 50%;
float: right;
padding-left: 10px;
}
39 changes: 39 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
site_name: ELISA - Open Source Engineering Process
repo_url: https://github.com/elisa-tech/wg-osep
site_url: !ENV [BASE_URL, https://osep.elisa.tech/]
site_dir: public

theme:
name: material
logo: images/elisa-logo.svg
favicon: images/favicon.ico
icon:
repo: fontawesome/brands/github
font:
text: Open Sans
code: Fira Code
features:
- content.code.copy
- content.code.annotate
- navigation.footer
- navigation.top

extra_css:
- stylesheets/elisa.css

use_directory_urls: false

plugins:
- search

markdown_extensions:
- attr_list
- pymdownx.pathconverter:
absolute: true

nav:
- ELISA: https://elisa.tech/
- OSEP:
- Home: index.md


0 comments on commit 9d159a3

Please sign in to comment.