Sphinxとは
GitHub Actionsとは
デモ
Sphinxとは
GitHub Actionsとは
デモ
Python製のドキュメント作成ツール
Restructuredtextやで記述して、HTML、PDF、Wordなど様々なフォーマットで出力が可能
Hint
Markdownでも書くことはできる
Sphinxは知らなくてもSphinxで作成されたものは必ず見ているはず
使い方は簡単
$ pip install sphinx
$ sphinx-quickstart
これでドキュメントを書くためのフォーマットが作成される
$ tree -L 1
.
├── Makefile
├── build
├── docs
├── make.bat
└── source
├── _static
├── _templates
└── index.rst
選択するテンプレートによって先程のドキュメントサイトやこの資料のようなプレゼンテーションを作成できる
Sphinxとは
GitHub Actionsとは
デモ
GitHub上のイベントをトリガーとした(定期実行もあり)CI/CDのサービス
https://github.co.jp/features/actions
パブリックリポジトリは無料で、プライベートでも無料枠がある
トリガー
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
ジョブ
# 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
# 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
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
今回作ったWorkflow
https://raw.githubusercontent.com/mursts/python-tokai-41/master/.github/workflows/main.yml
name: Publish
on:
push:
branches: [ master ]
jobs:
publish:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build sphinx
run: make html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./build/html
GITHUB_TOKEN
Actionsを設定したときに自動でできるトークン
今回はこれを使用した
DEPLOY_KEY
自分で鍵を作ってGitHubに登録する
PERSONAL_TOKEN
settingsから作成するトークン
準備ができたらrstファイルを編集してmasterにPush
Sphinxとは
GitHub Actionsとは
デモ