Skip to content

Commit 5fbd48f

Browse files
committed
chore: update release workflow for PyPI publishing and simplify package build process
1 parent 0dd3f1d commit 5fbd48f

File tree

1 file changed

+5
-35
lines changed

1 file changed

+5
-35
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
permissions:
1515
contents: read
1616
packages: write
17+
id-token: write # needed for PyPI publishing
1718
outputs:
1819
image_name: ${{ steps.meta-backend.outputs.tags }}
1920

@@ -49,46 +50,15 @@ jobs:
4950
tags: ${{ steps.meta-backend.outputs.tags }}
5051
labels: ${{ steps.meta-backend.outputs.labels }}
5152

52-
publish-to-pypi:
53-
needs: [build-and-push-docker]
54-
runs-on: ubuntu-latest
55-
permissions:
56-
id-token: write
57-
packages: read
58-
defaults:
59-
run:
60-
working-directory: ./backend
61-
62-
steps:
63-
- name: Log in to the Container registry
64-
uses: docker/login-action@v3
65-
with:
66-
registry: ${{ env.REGISTRY }}
67-
username: ${{ github.actor }}
68-
password: ${{ secrets.GITHUB_TOKEN }}
69-
70-
- name: Build package in Docker
53+
- name: Build Python package
7154
run: |
72-
# Create a temporary container from the production image
73-
CONTAINER_ID=$(docker create ${{ needs.build-and-push-docker.outputs.image_name }})
74-
75-
# Start the container
76-
docker start $CONTAINER_ID
77-
7855
# Create dist directory
7956
mkdir -p dist
8057
81-
# Build the package inside the container
82-
docker exec $CONTAINER_ID pip install build
83-
docker exec $CONTAINER_ID python -m build
84-
85-
# Copy the built package from the container
86-
docker cp $CONTAINER_ID:/pyspur/backend/dist/. dist/
87-
88-
# Clean up
89-
docker rm -f $CONTAINER_ID
58+
# Build package using the container we just built
59+
docker run --rm -v $(pwd)/dist:/dist ${{ steps.meta-backend.outputs.tags }} sh -c "cd /pyspur/backend && uv build && cp dist/* /dist/"
9060
91-
- name: Publish package distributions to PyPI
61+
- name: Publish package to PyPI
9262
uses: pypa/gh-action-pypi-publish@release/v1
9363
with:
9464
packages-dir: dist/

0 commit comments

Comments
 (0)