This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Adds first PyPI publishing workflow #51
Merged
Merged
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c94efd9
testing pypi release test
binaryaaron b33d10c
adding tag filter for events
binaryaaron b837099
updated tag matching regex
binaryaaron 51ec605
added poetry installation steps
binaryaaron 629fa95
changed to pipe for multiple line breaks
binaryaaron 4c3e158
added extra checkout
binaryaaron 420511f
changed env var name
binaryaaron f380cdd
corrected org secret name
binaryaaron f8faee8
updated rc version
binaryaaron 0ea14b2
adding gh release uploader and bumping rc version
binaryaaron 57d7745
updating workflows
binaryaaron ec32585
updating workflow with better steps
binaryaaron 3ed90bc
removing github release publisher for testing
binaryaaron 314dee2
adding output env vars
binaryaaron e2c0891
test
binaryaaron 0f8becb
removing env var ref
binaryaaron 14a0226
remove dist check
binaryaaron 947f3c9
sourcing venv each step
binaryaaron 10a28ea
testing gh release
binaryaaron 7d95443
bumping rc version
binaryaaron baa1977
removed conditional for draft release
binaryaaron f8fcf66
bumping rc version
binaryaaron 9678450
updating download ref
binaryaaron 09aec53
testing artifact names
binaryaaron eaa41e0
adding back in artifact names
binaryaaron cb5067f
Update .github/workflows/publish.yaml
binaryaaron 075d2e0
Update .github/workflows/publish.yaml
binaryaaron af0e4ca
typos / corrections
binaryaaron 4fed54d
Merge branch 'main' into agonzales/publish-pypi
binaryaaron aba58c0
adding contributor docs
binaryaaron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Build and publish to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- "main" | ||
- "dev" | ||
- "release/v[0-9].[0-9]" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_dist: | ||
name: Build distribution 📦 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: set up python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: set up poetry | ||
id: setup | ||
run: | | ||
export VENV_PATH="$HOME/venv" | ||
python3 -m venv $VENV_PATH | ||
source "$VENV_PATH/bin/activate" | ||
pip install -U pip setuptools | ||
pip install poetry | ||
poetry config repositories.testpypi https://test.pypi.org/legacy/ | ||
poetry build | ||
|
||
- name: Archive Production Artifact | ||
uses: actions/upload-artifact@v4 | ||
id: lmbuddy_artifacts | ||
with: | ||
name: lmbuddy_dists | ||
path: dist/ | ||
retention-days: 1 | ||
|
||
- name: Publish dist to test pypi | ||
env: | ||
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.PYPI_TEST_KEY }} | ||
|
||
if: ${{ github.event_name == 'pull_request' }} | ||
run: | | ||
source "$HOME/venv/bin/activate" | ||
cd $GITHUB_WORKSPACE | ||
echo "$GITHUB_WORKSPACE" | ||
which poetry | ||
poetry publish --repository testpypi | ||
|
||
- name: Publish dist to real pypi | ||
env: | ||
POETRY_PYPI_TOKEN: ${{ secrets.PYPI_KEY }} | ||
if: endsWith(github.event.base_ref, 'main') == true | ||
run: | | ||
source "$HOME/venv/bin/activate" | ||
poetry publish | ||
|
||
github-release: | ||
name: Prepare release | ||
needs: | ||
- build_dist | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
id-token: write # IMPORTANT: mandatory for sigstore | ||
|
||
# should only run when commits are pushed to main and a tag is there (from above) | ||
steps: | ||
- name: download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: lmbuddy_dists | ||
path: ./dist/ | ||
merge-multiple: true | ||
|
||
|
||
- name: Release Draft | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: ./dist/* | ||
draft: true | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: endsWith(github.event.base_ref, 'main') == true | ||
with: | ||
files: ./dist/* | ||
draft: true |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should name the workflow a as a whole, or else it displays weird in the PR checks