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
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
docs/
.claude
.benchmarks
.venv
.nf-test
mouse-tracking-runtime
nextflow
support_code
vm
*.h5
*.sh
tests
2 changes: 1 addition & 1 deletion .github/workflows/_build-docker-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Pull Request Checks

on:
pull_request:
branches: [ main, repository-reorganization ]
branches: [ main ]

jobs:
format-lint:
Expand Down
140 changes: 140 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Build and Release

on:
push:
branches: [ main, master ]
paths:
- 'pyproject.toml'

permissions:
contents: write
id-token: write
packages: write

jobs:
format-lint:
name: "Format and Lint"
uses: ./.github/workflows/_format-lint-action.yml

test:
name: "Run Tests"
needs: format-lint
uses: ./.github/workflows/_run-tests-action.yml

build:
name: "Build Docker Image"
needs: [format-lint, test]
secrets: inherit
uses: ./.github/workflows/_build-docker-action.yml

check-version-changed:
name: "Check if version changed"
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
version-changed: ${{ steps.check.outputs.changed }}
is-prerelease: ${{ steps.version.outputs.is-prerelease }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Get current version
id: version
run: |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT

# Check if version contains letters (indicating pre-release)
if echo "$VERSION" | grep -q '[a-zA-Z]'; then
echo "is-prerelease=true" >> $GITHUB_OUTPUT
echo "Detected pre-release version: $VERSION"
else
echo "is-prerelease=false" >> $GITHUB_OUTPUT
echo "Detected stable release version: $VERSION"
fi

- name: Check if version changed
id: check
run: |
if git diff HEAD~1 HEAD --name-only | grep -q pyproject.toml; then
if git diff HEAD~1 HEAD pyproject.toml | grep -q '^+version = '; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changed in pyproject.toml"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "pyproject.toml changed but version did not change"
fi
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "pyproject.toml was not changed"
fi

build-package:
name: "Build Python Package"
runs-on: ubuntu-latest
needs: [build, check-version-changed]
if: needs.check-version-changed.outputs.version-changed == 'true'
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

- name: Set up Python
run: uv python install 3.10

- name: Build package
run: uv build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

publish-pypi:
name: "Publish to PyPI"
runs-on: ubuntu-latest
needs: [build-package, check-version-changed]
if: needs.check-version-changed.outputs.version-changed == 'true'
environment: release
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Publish to PyPI
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
working-directory: .

create-release:
name: "Create GitHub Release"
runs-on: ubuntu-latest
needs: [publish-pypi, check-version-changed]
if: needs.check-version-changed.outputs.version-changed == 'true'
steps:
- uses: actions/checkout@v4

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-version-changed.outputs.version }}
name: Release v${{ needs.check-version-changed.outputs.version }}
draft: false
prerelease: ${{ needs.check-version-changed.outputs.is-prerelease == 'true' }}
generate_release_notes: true
files: dist/*
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mouse-tracking"
version = "0.1.0"
version = "0.1.1"
description = "Runtime environment for mouse tracking experiments"
requires-python = ">=3.10,<3.11"
packages = ["src/mouse_tracking"]
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.