diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a7d7a4e..3f82a79 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,52 +1,10 @@ -name: Publish to PyPI +name: Release and Deploy on: push: - branches: [ main ] + branches: [main] + workflow_dispatch: {} jobs: - publish: - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Check if version changed - id: version_check - run: | - VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2) - echo "version=$VERSION" >> $GITHUB_OUTPUT - - if git diff HEAD^ HEAD -- pyproject.toml | grep -q 'version ='; then - echo "changed=true" >> $GITHUB_OUTPUT - else - echo "changed=false" >> $GITHUB_OUTPUT - fi - - - name: Build package - if: steps.version_check.outputs.changed == 'true' - run: uv build - - - name: Publish to PyPI - if: steps.version_check.outputs.changed == 'true' - env: - UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - run: uv publish - - - name: Create GitHub Release - if: steps.version_check.outputs.changed == 'true' - env: - GH_TOKEN: ${{ github.token }} - run: | - VERSION=${{ steps.version_check.outputs.version }} - gh release create "v$VERSION" \ - --title "v$VERSION" \ - --generate-notes \ - dist/* + release: + uses: TransitApp/actions/.github/workflows/python-release.yml@master diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b15dc21..6be74fc 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,32 +1,24 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Build on pull request on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build-and-test: - runs-on: [ubuntu-latest] + runs-on: ubuntu-latest strategy: matrix: python-version: ['3.10', 'pypy3.10'] - steps: - - uses: actions/checkout@v2 - - name: Install uv - uses: astral-sh/setup-uv@v5 - - name: Set up Python ${{ matrix.python-version }} - run: uv python install ${{ matrix.python-version }} - - name: Install dependencies - run: uv sync --all-extras --dev - - name: Lint with flake8 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6 + - run: uv python install ${{ matrix.python-version }} + - run: uv sync --all-extras --dev + - name: Lint run: | uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.venv uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=.venv - - name: Test with pytest - run: uv run pytest . + - run: uv run pytest . diff --git a/pyproject.toml b/pyproject.toml index 0b31242..d51093f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "py-gtfs-loader" -version = "0.3.1" +version = "0.3.2" description = "Load GTFS" readme = "README.md" authors = [