You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PYPI.md
+85-1
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ You'll need `twine` to securely upload your package to PyPI. If you don't have i
47
47
48
48
```bash
49
49
pip install twine
50
-
``````
50
+
```
51
51
52
52
5. Upload the package to PyPI:
53
53
Use `twine` to upload your package to PyPI. Run the following command:
@@ -98,3 +98,87 @@ Now that your package is on PyPI, you can install it using `pip` like any other
98
98
That's it! Your package is now available on PyPI and can be easily installed by others using `pip install githubauthlib`.
99
99
100
100
Keep in mind that publishing packages on PyPI is a public act, and it's essential to ensure your code is properly documented, well-tested, and adheres to best practices. Make sure to thoroughly test your package and keep it up-to-date with new releases if necessary.
101
+
102
+
# Publishing to PyPI using GitHub Actions Trusted Publisher
103
+
104
+
This project uses GitHub Actions and PyPI's trusted publisher workflow for secure, automated package publishing.
105
+
106
+
## Overview
107
+
108
+
Instead of manual uploads or stored credentials, we use GitHub's OIDC (OpenID Connect) integration with PyPI for secure publishing. This means:
109
+
110
+
- No API tokens or credentials needed
111
+
- Automated publishing on version tags
112
+
- Secure authentication via OIDC
113
+
114
+
## Publishing Process
115
+
116
+
1. **Local Build and Test**
117
+
118
+
```bash
119
+
# Run the build script to verify everything locally
120
+
./scripts/build_and_publish.sh
121
+
```
122
+
123
+
This will:
124
+
- Create a virtual environment
125
+
- Run all tests and checks
126
+
- Build the package locally
127
+
- Clean up afterward
128
+
129
+
2. **Create and Push a Version Tag**
130
+
131
+
```bash
132
+
# Create and push a new version tag
133
+
git tag v1.0.0
134
+
git push origin v1.0.0
135
+
```
136
+
137
+
The version number should match what's in `setup.py`.
138
+
139
+
3. **Automated Publishing**
140
+
- GitHub Actions will trigger on the tag push
141
+
- The workflow will:
142
+
- Run all tests
143
+
- Build the package
144
+
- Publish to PyPI using OIDC authentication
145
+
- Monitor the Actions tab for progress
146
+
147
+
4. **Verify Publication**
148
+
- Check the package page: https://pypi.org/project/githubauthlib/
149
+
- Try installing the package:
150
+
151
+
```bash
152
+
pip install githubauthlib
153
+
```
154
+
155
+
## PyPI Project Configuration
156
+
157
+
The PyPI project is configured with the following trusted publisher settings:
158
+
159
+
-**Publisher**: GitHub Actions
160
+
-**Organization**: fleXRPL
161
+
-**Repository**: githubauthlib
162
+
-**Workflow name**: workflow.yml
163
+
-**Environment**: pypi
164
+
165
+
## Security Notes
166
+
167
+
- No credentials are stored in the repository or GitHub secrets
168
+
- Authentication is handled via OIDC between GitHub and PyPI
169
+
- Only tagged commits from the main branch can trigger publishing
170
+
- All publishing attempts are logged and auditable
171
+
172
+
## Troubleshooting
173
+
174
+
If publishing fails:
175
+
176
+
1. Check the GitHub Actions logs
177
+
2. Verify the version tag matches setup.py
178
+
3. Ensure the workflow file matches PyPI's trusted publisher configuration
179
+
4. Verify the package builds locally with`./scripts/build_and_publish.sh`
0 commit comments