[Feature] Implement multi-factor model and aggregators #11
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - "src/quanteval/__init__.py" | |
| - "pyproject.toml" | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'If "true", publish to TestPyPI (requires TEST_PYPI_TOKEN).' | |
| required: false | |
| default: "false" | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if both version files were changed | |
| id: check_versions | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| # Compare with the previous commit to check if both files changed | |
| git diff --name-only HEAD~1 | grep -E "src/quanteval/__init__.py|pyproject.toml" > /tmp/changes.txt | |
| INIT_CHANGED=$(grep "src/quanteval/__init__.py" /tmp/changes.txt || echo "") | |
| PYPROJECT_CHANGED=$(grep "pyproject.toml" /tmp/changes.txt || echo "") | |
| if [[ -n "$INIT_CHANGED" && -n "$PYPROJECT_CHANGED" ]]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "⚠️ Release skipped: Both 'src/quanteval/__init__.py' and 'pyproject.toml' must be modified in the same commit." | |
| fi | |
| fi | |
| - name: Cancel if versions were not both changed | |
| if: steps.check_versions.outputs.changed == 'false' && github.event_name != 'workflow_dispatch' | |
| run: | | |
| echo "::error::Release cancelled: Both version files must be updated together" | |
| exit 1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[dev]" | |
| - name: Build release artifacts | |
| run: python -m build | |
| - name: Validate artifacts | |
| run: twine check dist/* | |
| - name: Publish to TestPyPI (dry-run) | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' }} | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install twine | |
| twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }} --skip-existing --verbose | |
| - name: Publish to PyPI | |
| if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true') }} | |
| uses: pypa/gh-action-pypi-publish@v1.5.0 | |
| with: | |
| skip-existing: true | |
| verbose: true | |
| user: __token__ | |
| password: ${{ secrets.PYPI_TOKEN }} |