diff --git a/.github/workflows/build-docset.yml b/.github/workflows/build-docset.yml new file mode 100644 index 00000000..36d3c12a --- /dev/null +++ b/.github/workflows/build-docset.yml @@ -0,0 +1,39 @@ +--- +name: Build docset + +on: + push: + tags: ["*"] + workflow_dispatch: + +env: + PIP_DISABLE_PIP_VERSION_CHECK: 1 + PIP_NO_PYTHON_VERSION_WARNING: 1 + +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + +jobs: + docset: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@v1 + with: + egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # get correct version once we switch to hatch-vcs + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - run: pip install tox + + - run: tox -e docset + + - uses: actions/upload-artifact@v3 + with: + name: docset + path: attrs.tgz diff --git a/.gitignore b/.gitignore index 3c89675a..f1c6979d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ .vscode build dist -docs/_build/ +docs/_build htmlcov tmp* +attrs.docset +attrs.tgz diff --git a/docs/_static/docset-icon.png b/docs/_static/docset-icon.png new file mode 100644 index 00000000..36d10348 Binary files /dev/null and b/docs/_static/docset-icon.png differ diff --git a/docs/_static/docset-icon@2x.png b/docs/_static/docset-icon@2x.png new file mode 100644 index 00000000..ae336fee Binary files /dev/null and b/docs/_static/docset-icon@2x.png differ diff --git a/tox.ini b/tox.ini index f0a84c29..2a2dfdaf 100644 --- a/tox.ini +++ b/tox.ini @@ -114,3 +114,18 @@ commands = nodeenv --prebuilt --node=lts --force {envdir} npm install -g --no-package-lock --no-save pyright pytest tests/test_pyright.py -vv + + +[testenv:docset] +deps = doc2dash +extras = docs +allowlist_externals = + rm + cp + tar +commands = + rm -rf attrs.docset attrs.tgz docs/_build + sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html + doc2dash --index-page index.html --icon docs/_static/docset-icon.png --online-redirect-url https://www.attrs.org/en/latest/ docs/_build/html + cp docs/_static/docset-icon@2x.png attrs.docset/icon@2x.png + tar --exclude='.DS_Store' -cvzf attrs.tgz attrs.docset