Add configurable time weighting initial state (#49) #21
Workflow file for this run
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: Publish to PyPI and Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'jmrplens/PyOctaveBand' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Validate tag version | |
| id: version | |
| run: | | |
| PACKAGE_VERSION=$(python - <<'PY' | |
| import ast | |
| from pathlib import Path | |
| version_file = Path("src/pyoctaveband/_version.py") | |
| module = ast.parse(version_file.read_text(encoding="utf-8")) | |
| for node in module.body: | |
| if isinstance(node, ast.Assign): | |
| for target in node.targets: | |
| if isinstance(target, ast.Name) and target.id == "__version__": | |
| print(ast.literal_eval(node.value)) | |
| raise SystemExit(0) | |
| raise SystemExit("Unable to find __version__ in src/pyoctaveband/_version.py") | |
| PY | |
| ) | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then | |
| echo "::error::Tag ${GITHUB_REF_NAME} does not match package version ${PACKAGE_VERSION}" | |
| exit 1 | |
| fi | |
| echo "version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT" | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package | |
| run: python -m twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: python -m twine upload dist/* | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: Release ${{ steps.version.outputs.tag }} | |
| body: | | |
| Automated release for version ${{ steps.version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |