Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 167 additions & 50 deletions .github/workflows/tag_and_publish.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,170 @@
name: Tag and Publish
# To restore this workflow, uncomment the lines below
#on:
# push:
# branches:
# - main
# - dev
jobs:
test-lint-and-type-check:
uses: AllenNeuralDynamics/aind-python-library-template/.github/workflows/test_lint_type.yml@main
name: Publish

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
extract_info:
runs-on: windows-latest
outputs:
project_name: ${{ steps.get_info.outputs.PACKAGE_NAME }}
project_version: ${{ steps.get_info.outputs.PACKAGE_VERSION }}
project_name_underscores: ${{ steps.get_info.outputs.PACKAGE_NAME_UNDERSCORES }}
tag_already_exists: ${{ steps.check_existing_tag.outputs.exists }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Get package name and version
id: get_info
run: |
$version = uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version
$package_name = uvx --from=toml-cli toml get --toml-path=pyproject.toml project.name
echo "PACKAGE_VERSION=$version" >> $env:GITHUB_OUTPUT
echo "PACKAGE_NAME=$package_name" >> $env:GITHUB_OUTPUT
echo "PACKAGE_NAME_UNDERSCORES=$package_name".Replace('-', '_') >> $env:GITHUB_OUTPUT

- name: Check if tag exists
id: check_existing_tag
uses: mukunku/tag-exists-action@v1.6.0
with:
tag: v${{ steps.get_info.outputs.PACKAGE_VERSION }}


tag:
runs-on: self-hosted-good
needs: test-lint-and-type-check
env:
UV_PYTHON_INSTALL_DIR: C:\ProgramData\AIBS_MPE\uv_python
UV_TOOL_DIR: C:\ProgramData\AIBS_MPE\uv_python
needs: extract_info
if: needs.extract_info.outputs.tag_already_exists == 'false'
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
append_to_pre_release_tag: 'dev'
pre_release_branches: dev
# custom_release_rules: 'fix:patch,feat:minor,breaking:major'
- name: Install UV
uses: astral-sh/setup-uv@v5
- name: Update Version in pyproject.toml
run: uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version ${{ steps.tag_version.outputs.new_version }}
- name: Commit and push pyproject.toml version bump
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "ci: version bump"
push: true
publish:
runs-on: self-hosted-good
needs: tag
env:
UV_PYTHON_INSTALL_DIR: C:\ProgramData\AIBS_MPE\uv_python
UV_TOOL_DIR: C:\ProgramData\AIBS_MPE\uv_python
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
run: uv sync

- name: Create Git tag
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag -a v${{ needs.extract_info.outputs.project_version }} -m "v${{ needs.extract_info.outputs.project_version }}"
if ($LASTEXITCODE) { exit $LASTEXITCODE }
git push origin v${{ needs.extract_info.outputs.project_version }}
if ($LASTEXITCODE) { exit $LASTEXITCODE }

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.extract_info.outputs.project_version }}
name: Release v${{ needs.extract_info.outputs.project_version }}
generate_release_notes: true
prerelease: ${{ github.ref != 'refs/heads/main' }}


# release-build:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4

# - uses: actions/setup-python@v5
# with:
# python-version: "3.x"

# - name: Build release distributions
# run: |
# # NOTE: put your own distribution build steps here.
# python -m pip install build
# python -m build

# - name: Upload distributions
# uses: actions/upload-artifact@v4
# with:
# name: release-dists
# path: dist/

# pypi-publish:
# runs-on: ubuntu-latest
# needs:
# - release-build
# permissions:
# # IMPORTANT: this permission is mandatory for trusted publishing
# id-token: write

# # Dedicated environments with protections for publishing are strongly recommended.
# # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
# environment:
# name: pypi
# # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
# # url: https://pypi.org/p/YOURPROJECT
# #
# # ALTERNATIVE: if your GitHub Release name is the PyPI project version string
# # ALTERNATIVE: exactly, uncomment the following line instead:
# # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}

# steps:
# - name: Retrieve release distributions
# uses: actions/download-artifact@v4
# with:
# name: release-dists
# path: dist/

# - name: Publish release distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# packages-dir: dist/
# password: ${{ secrets.AIND_PYPI_TOKEN }}

build-docs:
needs: extract_info
runs-on: windows-latest
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
actions: write # Necessary to cancel workflow executions
checks: write # Necessary to write reports
pull-requests: write # Necessary to comment on PRs
contents: read
packages: write
steps:
- name: Install UV
uses: astral-sh/setup-uv@v5
- name: Build Project
run: uv build
- name: Publish Project to eng-tools devpi
run: uv publish --publish-url http://eng-tools:3141/aibs/packages --username aibs --password aibs
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
run: uv sync --group docs

- name: Build docs
run: uv run mkdocs build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/public_html

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
user_name: github-actions[bot]
user_email: github-actions[bot]@users.noreply.github.com
commit_message: "Update docs for v${{ needs.extract_info.outputs.project_version }}"
6 changes: 6 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ Python tools for remote control (RPC) and streaming over ZeroMQ.

- [Client API](api/client.md)
- [Server API](api/server.md)


## Exceptions

::: one_liner.utils.StreamException
::: one_liner.utils.RPCException
9 changes: 8 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ docs_dir: docs
theme:
name: material

markdown_extensions:
- admonition
- pymdownx.magiclink # For in-line references to functions/methods.

plugins:
- search
- autorefs
Expand All @@ -18,10 +22,13 @@ plugins:
paths:
- src
options:
filters:
- "!^__slots__$" # Omit slots
show_root_heading: true
show_if_no_docstring: false
show_source: false
members_order: source
docstring_style: sphinx
docstring_style: numpy

nav:
- Home: index.md
Expand Down
Loading
Loading