Skip to content

Commit

Permalink
Merge pull request #23 from Cyrogon/New-Build-Method
Browse files Browse the repository at this point in the history
New build method
  • Loading branch information
devbence authored Apr 12, 2024
2 parents 02db45c + cd24cbb commit 3e2d74e
Show file tree
Hide file tree
Showing 27 changed files with 2,141 additions and 279 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
47 changes: 47 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is a basic workflow to help you get started with Actions

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" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
pages: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
- name: build
run: |
pip3 install sphinx
pip3 install sphinx_rtd_theme
pip3 install pyyaml
pip3 install sphinxcontrib-video
npm install -g jsdoc
git fetch --tags
cd docs
mkdir build
python3 build_docs.py
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: './pages'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
157 changes: 2 additions & 155 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,156 +1,3 @@

# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks

### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/

.ipynb_checkpoints
*/.ipynb_checkpoints/*

# IPython
profile_default/
ipython_config.py

# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
/docs/build
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook

# IPython

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# End of https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks
act.exe
13 changes: 0 additions & 13 deletions .readthedocs.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stay In Tarkov Documentation

https://docs.stayintarkov.com/
1 change: 0 additions & 1 deletion README.rst

This file was deleted.

File renamed without changes.
12 changes: 4 additions & 8 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Compile .po files to .mo files
compile_po:
msgfmt -o build/zh_cn/LC_MESSAGES/SITChina.mo build/zh_cn/LC_MESSAGES/SITChina.po

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

.PHONY: help Makefile compile_po
.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)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
44 changes: 44 additions & 0 deletions docs/build_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import os
import subprocess
import yaml

# Define an array with en inside since en will always build
langs = ["en"]

# Create a fucntion that makes a shorthand for the make command as well as setting OS vars
# before execution
def build_doc(version, language):
os.environ["current_version"] = version
os.environ["current_language"] = language
os.environ['SPHINXOPTS'] = "-D language='{}'".format(language)
subprocess.run("make html", shell=True)

os.environ["build_all_docs"] = str(True)
os.environ["pages_root"] = "https://docs.stayintarkov.com/"

# Create a shorthand for making and moving a directory
def move_dir(src, dst):
subprocess.run(["mkdir", "-p", dst])
subprocess.run("mv "+src+'* ' + dst, shell=True)

# List all Langs in the Locales folder for building
langs += os.listdir("locales")

# Iterate over all found languages and build then move each one to it's designated dir
for i in langs:
build_doc("latest", i)
move_dir("./build/html/", "../pages/{}".format(i))

# Move the index.html to the root pages directory so it redirects to the en docs
subprocess.run("mv ./templates/index.html ../pages/index.html", shell=True)

# Open the versions files to see what versions to build and what langs they supported
with open("versions.yaml", "r") as yaml_file:
docs = yaml.safe_load(yaml_file)

# Loop over all the values and build the versions with their respective language
for version, details in docs.items():
tag = details.get('tag', '')
for language in details.get('languages', []):
build_doc(version, language)
move_dir("./build/html/", "../pages/"+version+'/'+language+'/')
Loading

0 comments on commit 3e2d74e

Please sign in to comment.