Skip to content

ci(docs): integrate to main workflow #229

ci(docs): integrate to main workflow

ci(docs): integrate to main workflow #229

Workflow file for this run

on:
push:
jobs:
nix:
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: cachix/cachix-action@v12
with:
name: fractopo
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Check with nix
run: |
nix flake check
poetry:
strategy:
matrix:
platform: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]
runs-on: ${{ matrix.platform }}
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@v2
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: cachix/cachix-action@v12
with:
name: fractopo
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Test with poetry on Python ${{ matrix.python-version }}
run: |
nix run .#poetry-run -- ${{ matrix.python-version }} pytest
release:
runs-on: ubuntu-latest
needs: [nix, poetry]
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@v2
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: cachix/cachix-action@v12
with:
name: fractopo
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build package with poetry
run: |
nix develop -c poetry check
nix develop -c poetry build
- name: Check that version in pyproject.toml is equivalent to tag
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
run: |
nix run .#sync-git-tag-with-poetry
git diff --exit-code
- name: Publish distribution 📦 to PyPI on tagged commit pushes
# Publish to PyPI on tagged commit pushes on master
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
- name: Create incremental changelog
run: >
sed -n '2,/Release Changelog/p' CHANGELOG.md | head -n -4
> RELEASE_CHANGELOG.md
- name: Echo RELEASE_CHANGELOG.md
run: cat RELEASE_CHANGELOG.md
- name: Publish release on GitHub
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
body_path: RELEASE_CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docs:
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
needs: [nix]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: cachix/cachix-action@v12
with:
name: fractopo
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build documentation
run: |
nix build .#fractopo.doc
cp -Lr --no-preserve=mode,ownership,timestamps ./result-doc/share/doc/* ./docs
- uses: actions/upload-pages-artifact@v2
with:
# Upload folder with static docs
path: "docs/html"
- uses: actions/configure-pages@v3
- id: deployment
uses: actions/deploy-pages@v2