-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add logo, favicon, badges, pypi deployment config, and missing …
…doc gen git workflows
- Loading branch information
Showing
7 changed files
with
233 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'feature/**' | ||
|
||
jobs: | ||
build: | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U build pip | ||
pip install .[doc] | ||
- name: Build docs | ||
run: | | ||
make clean_doc | ||
python -m build | ||
make doc_html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Build & Update Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Determine branch/tag and set git author | ||
run: | | ||
if [[ "$GITHUB_REF" == refs/tags/* ]]; then | ||
CURBRANCH=${GITHUB_REF##*/} | ||
BUILD_TYPE="tag" | ||
elif [[ "$GITHUB_REF" == refs/heads/* ]]; then | ||
CURBRANCH=${GITHUB_REF##*/} | ||
BUILD_TYPE="branch" | ||
else | ||
CURBRANCH="unknown" | ||
BUILD_TYPE="unknown" | ||
fi | ||
CURBRANCH=$( echo "$CURBRANCH" | sed 's+/+_+g' ) | ||
echo "Building branch/tag ${CURBRANCH:-<unknown>}, from git ref <$GITHUB_REF>" | ||
echo "CURBRANCH=${CURBRANCH}" >> "${GITHUB_ENV}" | ||
echo "BUILD_TYPE=${BUILD_TYPE}" >> "${GITHUB_ENV}" | ||
git config user.email "[email protected]" | ||
git config user.name "nxbench bot" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[doc] | ||
- name: Build docs | ||
run: | | ||
make clean_doc | ||
make doc_html | ||
- name: Create Redirect | ||
run: | | ||
echo '<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="refresh" content="0; url=main/index.html"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>nxbench Documentation</title> | ||
</head> | ||
<body> | ||
<p>If you are not redirected, <a href="main/index.html">click here</a>.</p> | ||
</body> | ||
</html>' > index.html | ||
- name: Deploy to gh-pages | ||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
git stash --include-untracked | ||
git fetch origin gh-pages | ||
git checkout gh-pages || git checkout --orphan gh-pages | ||
if [[ "${BUILD_TYPE}" == "branch" && "${CURBRANCH}" == "main" ]]; then | ||
git rm -rf main/ || true | ||
elif [[ "${BUILD_TYPE}" == "tag" ]]; then | ||
git rm -rf "${CURBRANCH}/" || true | ||
fi | ||
if [[ "${BUILD_TYPE}" == "branch" && "${CURBRANCH}" == "main" ]]; then | ||
mkdir -p main/ | ||
cp -r doc/build/html/* main/ | ||
elif [[ "${BUILD_TYPE}" == "tag" ]]; then | ||
mkdir -p "${CURBRANCH}/" | ||
cp -r doc/build/html/* "${CURBRANCH}/" | ||
fi | ||
git checkout gh-pages -- index.html || true | ||
git add . | ||
git commit -m "doc: Update documentation for ${CURBRANCH}" || true | ||
git push origin gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
# name: Build and Deploy to PyPI | ||
name: Build and Deploy to PyPI | ||
|
||
# on: | ||
# push: | ||
# tags: | ||
# - 'v*.*.*' | ||
# repository_dispatch: | ||
# types: [deploy-pypi] | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
repository_dispatch: | ||
types: [deploy-pypi] | ||
|
||
# jobs: | ||
# build-and-deploy: | ||
# name: Build and Deploy to PyPI | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout Code | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
jobs: | ||
build-and-deploy: | ||
name: Build and Deploy to PyPI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# - name: Set up Python | ||
# uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: '3.10' | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
# - name: Cache pip | ||
# uses: actions/cache@v4 | ||
# with: | ||
# path: ~/.cache/pip | ||
# key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-pip- | ||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
# - name: Install Dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip setuptools wheel twine | ||
# pip install -U build | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel twine | ||
pip install -U build | ||
# - name: Build Package | ||
# run: | | ||
# python -m build --sdist --wheel | ||
- name: Build Package | ||
run: | | ||
python -m build --sdist --wheel | ||
# - name: Publish to PyPI | ||
# uses: pypa/[email protected] | ||
# with: | ||
# user: __token__ | ||
# password: ${{ secrets.PYPI_API_TOKEN }} | ||
# env: | ||
# TWINE_USERNAME: __token__ | ||
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
- name: Publish to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
# name: Release | ||
|
||
# on: | ||
# push: | ||
# branches: | ||
# - main | ||
|
||
# jobs: | ||
# bump-version-and-tag: | ||
# name: Bump Version and Create Tag | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout Code | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
|
||
# - name: Set up Python | ||
# uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: '3.10' | ||
|
||
# - name: Install Dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install bump2version | ||
|
||
# - name: Configure Git user | ||
# run: | | ||
# git config --global user.email "[email protected]" | ||
# git config --global user.name "nxbench bot" | ||
|
||
# - name: Bump Version | ||
# run: | | ||
# bump2version patch --allow-dirty | ||
|
||
# - name: Push Changes and Tags | ||
# uses: ad-m/[email protected] | ||
# with: | ||
# github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
# branch: main | ||
# tags: true | ||
|
||
# - name: Trigger PyPI Deployment | ||
# uses: peter-evans/repository-dispatch@v2 | ||
# with: | ||
# token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
# event-type: deploy-pypi | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
bump-version-and-tag: | ||
name: Bump Version and Create Tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install bump2version | ||
- name: Configure Git user | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "nxbench bot" | ||
- name: Bump Version | ||
run: | | ||
bump2version patch --allow-dirty | ||
- name: Push Changes and Tags | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
branch: main | ||
tags: true | ||
|
||
- name: Trigger PyPI Deployment | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
event-type: deploy-pypi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.