Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
html5syt authored Apr 19, 2024
0 parents commit 03d781b
Show file tree
Hide file tree
Showing 47 changed files with 1,376 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.*
images
README.md

# mkdocs
mkdocs.yml
docs
site

# pipenv
Pipfile
Pipfile.lock

# amplify console
amplify.yml

# netlify
netlify.toml
runtime.txt
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_size = 4
indent_style = tab
110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
release:
types: [published]
workflow_dispatch:

jobs:
hadolint:
uses: peaceiris/workflows/.github/workflows/hadolint.yml@v0.19.1

pipenv:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- uses: actions/cache@v3
with:
path: ~/.cache/pipenv
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-
- run: python3 -m pip install --upgrade pip pipenv
- run: pipenv sync --dev
- run: pipenv run mkdocs build --config-file ./mkdocs-sample.yml

netlify:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Upgrade pip
run: python3 -m pip install --upgrade pip

- name: Get pip cache dir
id: pip-cache
run: echo "PIP_CACHE_DIR=$(pip cache dir)" | tee -a "${GITHUB_OUTPUT}"

- uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: python3 -m pip install -r ./requirements.txt

- run: npx netlify-cli build
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

docker:
runs-on: ubuntu-22.04
env:
DOCKER_BASE_NAME: ghcr.io/peaceiris/mkdocs-material
steps:
- uses: actions/checkout@v4

- name: Set env
run: |
if [ "${{ github.event_name }}" = 'release' ]; then
export TAG_NAME="${{ github.event.release.tag_name }}"
else
export TAG_NAME="latest"
fi
echo "PKG_TAG=${DOCKER_BASE_NAME}:${TAG_NAME}" >> ${GITHUB_ENV}
- name: Build
run: |
docker build . -t "${PKG_TAG}"
- run: docker images

- name: Get mkdocs-material version
id: get-version
run: |
export MKDOCS_MATERIAL_VERSION=$(docker run --rm --entrypoint=bash "${PKG_TAG}" -c 'pip show mkdocs-material | grep -E ^Version')
echo "MKDOCS_MATERIAL_VERSION=${MKDOCS_MATERIAL_VERSION}" | tee -a "${GITHUB_OUTPUT}"
- run: echo "${{ steps.get-version.outputs.MKDOCS_MATERIAL_VERSION }}"

- name: mkdocs build
run: docker-compose run --rm mkdocs mkdocs build --config-file ./mkdocs-sample.yml

- name: Login to Registries
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u peaceiris --password-stdin
- name: Push to GitHub Packages
if: ${{ github.event_name != 'pull_request' }}
run: docker push "${PKG_TAG}"
16 changes: 16 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'

on:
pull_request:

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/dependency-review-action@v3
46 changes: 46 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: github pages

on:
push:
branches:
- main
pull_request:

jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Upgrade pip
run: |
# install pip=>20.1 to use "pip cache dir"
python3 -m pip install --upgrade pip
python3 -m pip -V
- name: Get pip cache dir
id: pip-cache
run: echo "PIP_CACHE_DIR=$(pip cache dir)" | tee -a "${GITHUB_OUTPUT}"

- uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: python3 -m pip install -r ./requirements.txt

- run: mkdocs build --config-file ./mkdocs-sample.yml

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
workflow_dispatch:
inputs:
semver_type:
description: "Semver type"
required: true
type: "choice"
options:
- "patch"
- "minor"
# - "major"
default: "patch"

jobs:
main:
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: peaceiris/workflows/setup-node@v0.19.1
with:
node-version: "16"
- uses: peaceiris/workflows/setup-git@v0.19.1
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
CURRENT_TAG=$(git describe --tags --abbrev=0)
NEW_VERSION=$(npm_config_yes=true npx semver "${CURRENT_TAG}" --increment ${{ github.event.inputs.semver_type }})
NEW_TAG="v${NEW_VERSION}"
RELEASE_TITLE="Release ${NEW_TAG}"
git tag -a "${NEW_TAG}" -m "${RELEASE_TITLE}"
git push origin "${NEW_TAG}"
gh release create "${NEW_TAG}" ${{ github.event.inputs.is_draft }} --title "${RELEASE_TITLE}" --generate-notes
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# mkdocs documentation
/site

# python
.venv

# editor
.vscode
12 changes: 12 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
image:
name: ghcr.io/peaceiris/mkdocs-material:v3.5.3

pages:
script:
- mkdocs build --config-file ./mkdocs-sample.yml
- mv site public
artifacts:
paths:
- public
only:
- main
2 changes: 2 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignored:
- DL3013
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.11-slim-buster

LABEL maintainer="peaceiris"

# Install requirements
COPY ./requirements.txt /root
WORKDIR /root
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir -r ./requirements.txt && \
python3 -m pip check

# Expose MkDocs development server port
EXPOSE 8000

# Start development server by default
CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 peaceiris

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
mkdocs = "==1.5.3"
mkdocs-material = "==8.2.11"
python-markdown-math = "==0.8"
Pygments = "==2.11.2"
prompt_toolkit = "==3.0.43"
pyyaml = "==6.0"
Jinja2 = "==3.1.3"

[dev-packages]
invoke = "*"

[requires]
python_version = "3.10"

[pipenv]
allow_prereleases = true

[scripts]
version = "mkdocs --version"
help = "mkdocs --help"
serve = "inv serve"
build = "mkdocs build"
deploy = "mkdocs gh-deploy"
Loading

0 comments on commit 03d781b

Please sign in to comment.