-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use proper publish workflow * Push * Update flow * Test output * Beautiful * Cute
- Loading branch information
Showing
2 changed files
with
51 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.