diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml index 8a4ba21c..c9a94828 100644 --- a/.github/workflows/release_workflow.yml +++ b/.github/workflows/release_workflow.yml @@ -1,41 +1,40 @@ -name: Upload Python Package +name: Build and publish on: - release: - types: [created] + push: jobs: - build_deploy: - + build: + name: Build wheel and sdist runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v5 + ref: ${{ github.ref }} + - uses: hynek/build-and-inspect-python-package@v2 + + publish: + name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + environment: + name: publishing + url: https://pypi.org/p/meltanolabs-target-postgres + needs: build + permissions: + contents: write + id-token: write + + steps: + - uses: actions/download-artifact@v4 with: - python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry - - name: Build package - run: | - poetry self add "poetry-dynamic-versioning[plugin]" - poetry config repositories.testpypi https://test.pypi.org/legacy/ - poetry dynamic-versioning --no-cache - poetry build - - name: Upload wheel to release - uses: svenstaro/upload-release-action@v2 + name: Packages + path: dist + - uses: svenstaro/upload-release-action@v2 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} file: dist/*.whl tag: ${{ github.ref }} overwrite: true file_glob: true - - name: Deploy to PyPI - run: | - poetry publish -r testpypi -u "__token__" -p "${{ secrets.TEST_PYPI_TOKEN }}" - poetry publish -u "__token__" -p "${{ secrets.POSTGRES_PYPI_TOKEN }}" + - uses: pypa/gh-action-pypi-publish@v1.8.11 diff --git a/pyproject.toml b/pyproject.toml index a0c4540a..020e87fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ module = ["sshtunnel"] ignore_missing_imports = true [build-system] -requires = ["poetry-core==1.8.1", "poetry-dynamic-versioning==1.2.0"] +requires = ["poetry-core==1.9.0", "poetry-dynamic-versioning==1.3.0"] build-backend = "poetry_dynamic_versioning.backend" [tool.poetry.scripts]