14
14
permissions :
15
15
contents : read
16
16
packages : write
17
+ id-token : write # needed for PyPI publishing
17
18
outputs :
18
19
image_name : ${{ steps.meta-backend.outputs.tags }}
19
20
@@ -49,46 +50,15 @@ jobs:
49
50
tags : ${{ steps.meta-backend.outputs.tags }}
50
51
labels : ${{ steps.meta-backend.outputs.labels }}
51
52
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
71
54
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
-
78
55
# Create dist directory
79
56
mkdir -p dist
80
57
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/"
90
60
91
- - name : Publish package distributions to PyPI
61
+ - name : Publish package to PyPI
92
62
uses : pypa/gh-action-pypi-publish@release/v1
93
63
with :
94
64
packages-dir : dist/
0 commit comments