style: add linting and pre-commit (#40) #10
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
name: CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
build-docs: | |
needs: [bump-version] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python 3.10 and TRIQS | |
uses: ./.github/actions/setup-triqs | |
with: | |
python-version: "3.10" | |
- name: Install risb and docs dependencies | |
run: | | |
source $TRIQS_INSTALL/share/triqs/triqsvars.sh | |
python -m pip install .[docs] | |
- name: Build docs | |
run: | | |
source $TRIQS_INSTALL/share/triqs/triqsvars.sh | |
sphinx-apidoc -o docs/api --module-first --no-toc --force --separate src/risb | |
sphinx-build -b html -n -T docs docs/_build | |
- name: Upload docs artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs-build | |
path: docs/_build | |
deploy-docs: | |
needs: [build-docs] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
name: Deploy docs | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Download docs artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs-build | |
path: _site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
dist: | |
needs: [bump-version] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: hynek/build-and-inspect-python-package@v2 | |
publish: | |
needs: [dist] | |
environment: pypi | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Packages | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 |