diff --git a/.github/workflows/wheel-builder.yml b/.github/workflows/release-handler.yml similarity index 71% rename from .github/workflows/wheel-builder.yml rename to .github/workflows/release-handler.yml index 6a6c140..f10a0c9 100644 --- a/.github/workflows/wheel-builder.yml +++ b/.github/workflows/release-handler.yml @@ -1,8 +1,8 @@ -name: Build Wheel on PR +name: Build Wheel & Publish to PyPI on PR on: pull_request: - types: [opened, synchronize, edited, reopened] + types: [opened, synchronize, edited] jobs: build: @@ -29,6 +29,16 @@ jobs: mkdir -p wheel_files cp dist/*.whl wheel_files/ + - name: Install twine + run: python -m pip install --upgrade twine + + - name: Publish to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* + - name: Configure Git run: | git config --global user.name "github-actions[bot]" @@ -45,6 +55,14 @@ jobs: git commit -m "Add new wheel file" git push "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git" HEAD:${{ github.head_ref }} + - name: Create and push tag + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + VERSION_TAG=$(echo ${GITHUB_HEAD_REF} | sed -n 's/^rel-\(.*\)$/v\1/p') + git tag $VERSION_TAG + git push "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git" $VERSION_TAG + - name: Rename wheel file run: | PR_NUMBER=${{ github.event.number }} diff --git a/setup.py b/setup.py index 0ccc63a..9885afa 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( name="gps2gtfs", packages=find_packages(), - version="0.1.1-rc1", + version="main", description="A Python package to process raw GPS data of public transit and transform to GTFS format.", long_description=long_description, long_description_content_type="text/markdown", diff --git a/wheel_files/gps2gtfs-0.1.0-py3-none-any.whl b/wheel_files/gps2gtfs-0.1.0-py3-none-any.whl deleted file mode 100644 index 9e96603..0000000 Binary files a/wheel_files/gps2gtfs-0.1.0-py3-none-any.whl and /dev/null differ diff --git a/wheel_files/gps2gtfs-0.1.1rc1-py3-none-any.whl b/wheel_files/gps2gtfs-0.1.1rc1-py3-none-any.whl deleted file mode 100644 index ab44e8b..0000000 Binary files a/wheel_files/gps2gtfs-0.1.1rc1-py3-none-any.whl and /dev/null differ