From a29fd18d546003ba7f39c25d08a38cc8e6865567 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Fri, 20 Sep 2024 20:00:33 +0200 Subject: [PATCH] Update flow --- .github/workflows/publish.yml | 40 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5f93ea7..6f9d93b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,11 +7,44 @@ on: # types: [created] jobs: + build: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.inspect_package.outputs.version }} + steps: + - 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@v3 + with: + name: dist + path: dist + deploy: runs-on: ubuntu-latest + needs: build + environment: name: pypi - url: https://pypi.org/p/mangum/${{ steps.my_step.outputs.version }} + url: https://pypi.org/p/mangum/${{ needs.build.outputs.version }} steps: - uses: actions/checkout@v4 @@ -27,8 +60,3 @@ jobs: - name: Install dependencies run: uv build - - - name: Publish to PyPI - id: my_step - run: | - echo "version=0.1.0" >> "$GITHUB_OUTPUT"