Skip to content

Commit

Permalink
Add website (#11)
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Lau <[email protected]>
  • Loading branch information
AurevoirXavier authored Dec 14, 2023
1 parent fda3096 commit 5905bba
Show file tree
Hide file tree
Showing 13 changed files with 909 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/replace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import re


def replace_pattern_in_file(file_path, pattern, replacement):
with open(file_path, "r+") as file:
file_contents = file.read()
updated_contents = re.sub(pattern, replacement, file_contents)

file.seek(0)
file.write(updated_contents)


for root, dirs, files in os.walk(
os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "DIPs")
):
for filename in files:
if filename.endswith(".md"):
file_path = os.path.join(root, filename)

replace_pattern_in_file(
file_path,
r"\.\./LICENSE",
"https://github.com/darwinia-network/DIPs/blob/main/LICENSE",
)

print("Replacement complete.")
49 changes: 49 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy Pages

on:
push:
branches: ["main"]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: 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:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'poetry'
- name: Build
run: |
python3 .github/replace.py
cd website
pip3 install poetry
poetry shell
make html
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: "website/_build"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
# Integrated Development Environment
.idea
.vscode

# Cache
_build
3 changes: 2 additions & 1 deletion DIPs/dip-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ created: 2023-11-28
---


# DIP-0
## Abstract
This DIP explicates the staking power specification applicable to Darwinia and Crab.

Expand Down Expand Up @@ -60,4 +61,4 @@ assert_eq!(power_of(S2), 75 / 100 * HALF_POWER + 25 / 50 * HALF_POWER);


## Copyright
Copyright and related rights waived via [CC0](../LICENSE).
Copyright and related rights waived via [CC0](https://github.com/darwinia-network/DIPs/blob/main/LICENSE).
3 changes: 2 additions & 1 deletion DIPs/dip-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ created: 2023-11-27
---


# DIP-1
## Abstract
This DIP outlines the staking commission specification applicable on Darwinia and Crab.

Expand Down Expand Up @@ -63,4 +64,4 @@ let abr = remain * aa_of_pa; // , which is `45 * 90 / 135 = 30`.


## Copyright
Copyright and related rights waived via [CC0](../LICENSE).
Copyright and related rights waived via [CC0](https://github.com/darwinia-network/DIPs/blob/main/LICENSE).
3 changes: 2 additions & 1 deletion DIPs/dip-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ created: 2023-12-13
---


# DIP-2
## Abstract
To facilitate Ethereum integration, Substrate-based chains are transitioning to `H160` account addresses, using `ECDSA` for signatures.
This change streamlines the user experience by consolidating address types and wallets.
Expand Down Expand Up @@ -47,4 +48,4 @@ All pallet addresses have been truncated to 20 bytes; simply remove the trailing


## Copyright
Copyright and related rights waived via [CC0](../LICENSE).
Copyright and related rights waived via [CC0](https://github.com/darwinia-network/DIPs/blob/main/LICENSE).
8 changes: 8 additions & 0 deletions logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions website/DIPs
20 changes: 20 additions & 0 deletions website/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
17 changes: 17 additions & 0 deletions website/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
project = 'dips'
copyright = '2023, Darwinia Network'
author = 'Darwinia Network'

extensions = ['myst_parser']

exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

html_title = 'Darwinia Improvement Proposals'
html_logo = '../logo.svg'
html_theme = 'furo'
html_static_path = ['_static']
html_theme_options = {
'navigation_with_keys': True,
'sidebar_hide_name': True,
}

9 changes: 9 additions & 0 deletions website/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. include:: ../README.md
:parser: myst_parser.sphinx_


.. toctree::
:glob:
:hidden:

DIPs/*
Loading

0 comments on commit 5905bba

Please sign in to comment.