diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 394589d..36718c8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,36 +1,59 @@ name: Publish Python Package on: - release: - types: [created] + push: + tags: + - "**" jobs: - deploy: + build: runs-on: ubuntu-latest + outputs: + version: ${{ steps.inspect_package.outputs.version }} steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - uses: actions/cache@v2 - name: Configure pip caching + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v2 + with: + version: "0.4.12" + enable-cache: true + + - name: Set up Python + run: uv python install 3.12 + + - name: Build package + run: uv build + + - name: Inspect package version + id: inspect_package + run: | + version=$(uvx hatchling version) + echo "version=$version" >> "$GITHUB_OUTPUT" + + - name: Upload package + uses: actions/upload-artifact@v4 + with: + name: package-distributions + path: dist/ + + pypi-publish: + runs-on: ubuntu-latest + needs: build + + permissions: + id-token: write + + environment: + name: pypi + url: https://pypi.org/project/mangum/${{ needs.build.outputs.version }} + + steps: + - name: Download package + uses: actions/download-artifact@v4 with: - path: ~/.cache/pip - key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-publish-pip- - - name: Install dependencies - run: | - pip install -U -r requirements.txt - pip install setuptools wheel twine - - name: Run tests - run: scripts/test - - name: Publish - if: success() - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + name: package-distributions + path: dist/ + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index c23942a..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -mangum.io \ No newline at end of file