Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Adds first PyPI publishing workflow #51

Merged
merged 30 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c94efd9
testing pypi release test
binaryaaron Feb 13, 2024
b33d10c
adding tag filter for events
binaryaaron Feb 13, 2024
b837099
updated tag matching regex
binaryaaron Feb 13, 2024
51ec605
added poetry installation steps
binaryaaron Feb 13, 2024
629fa95
changed to pipe for multiple line breaks
binaryaaron Feb 13, 2024
4c3e158
added extra checkout
binaryaaron Feb 14, 2024
420511f
changed env var name
binaryaaron Feb 14, 2024
f380cdd
corrected org secret name
binaryaaron Feb 14, 2024
f8faee8
updated rc version
binaryaaron Feb 14, 2024
0ea14b2
adding gh release uploader and bumping rc version
binaryaaron Feb 14, 2024
57d7745
updating workflows
binaryaaron Feb 14, 2024
ec32585
updating workflow with better steps
binaryaaron Feb 14, 2024
3ed90bc
removing github release publisher for testing
binaryaaron Feb 14, 2024
314dee2
adding output env vars
binaryaaron Feb 14, 2024
e2c0891
test
binaryaaron Feb 14, 2024
0f8becb
removing env var ref
binaryaaron Feb 14, 2024
14a0226
remove dist check
binaryaaron Feb 14, 2024
947f3c9
sourcing venv each step
binaryaaron Feb 14, 2024
10a28ea
testing gh release
binaryaaron Feb 14, 2024
7d95443
bumping rc version
binaryaaron Feb 14, 2024
baa1977
removed conditional for draft release
binaryaaron Feb 14, 2024
f8fcf66
bumping rc version
binaryaaron Feb 14, 2024
9678450
updating download ref
binaryaaron Feb 14, 2024
09aec53
testing artifact names
binaryaaron Feb 14, 2024
eaa41e0
adding back in artifact names
binaryaaron Feb 14, 2024
cb5067f
Update .github/workflows/publish.yaml
binaryaaron Feb 14, 2024
075d2e0
Update .github/workflows/publish.yaml
binaryaaron Feb 14, 2024
af0e4ca
typos / corrections
binaryaaron Feb 14, 2024
4fed54d
Merge branch 'main' into agonzales/publish-pypi
binaryaaron Feb 14, 2024
aba58c0
adding contributor docs
binaryaaron Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build and Publish lm-buddy
binaryaaron marked this conversation as resolved.
Show resolved Hide resolved

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
binaryaaron marked this conversation as resolved.
Show resolved Hide resolved
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
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ Set up poetry to use the key(s):

```
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi $(op read "op://<VAULT>/PyPI-test/pypi/api_key")
poetry config pypi-token.pypi $(op read "op://<VAULT>/PyPI/pypi/api_key")
poetry config pypi-token.testpypi $(op read "op://mzai-dev/PyPI-test/pypi/api_key")
poetry config pypi-token.pypi $(op read "op://mzai-dev/PyPI/pypi/api_key")
```


### Testing publishing

Then build and publish to PyPI Test:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "lm-buddy"
version = "0.1.0"
version = "0.1.0rc10"
description = "Ray-centric library for finetuning and evaluation of (large) language models."
repository = "https://github.com/mozilla-ai/lm-buddy"
readme = "README.md"
Expand Down
Loading