-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github: add publish to pypi workflows
- Loading branch information
1 parent
e3ee3f9
commit 48bb3c6
Showing
2 changed files
with
140 additions
and
0 deletions.
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,69 @@ | ||
name: deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
gitref: | ||
type: string | ||
description: "what git ref to build" | ||
required: true | ||
|
||
jobs: | ||
build: | ||
name: "Build and upload wheel" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.gitref }} | ||
- name: Set up Python | ||
id: setup_python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Cache virtual environment | ||
uses: actions/cache@v3 | ||
with: | ||
# We are hashing requirements-dev.txt and requirements-extra.txt which | ||
# contain all dependencies needed to run the tests and examples. | ||
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }} | ||
path: .venv | ||
- name: Install system packages | ||
run: sudo apt-get install -y portaudio19-dev | ||
- name: Setup virtual environment | ||
run: | | ||
python -m venv .venv | ||
- name: Install basic Python dependencies | ||
run: | | ||
source .venv/bin/activate | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r requirements-dev.txt | ||
- name: Build project | ||
run: | | ||
source .venv/bin/activate | ||
python -m build | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist | ||
|
||
publish-to-pypi: | ||
name: "Publish to PyPI" | ||
runs-on: ubuntu-latest | ||
needs: [ build ] | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/dailyai | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ./dist | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: true | ||
print-hash: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: test-deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
build: | ||
name: "Build and upload wheel" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.gitref }} | ||
- name: Set up Python | ||
id: setup_python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Cache virtual environment | ||
uses: actions/cache@v3 | ||
with: | ||
# We are hashing requirements-dev.txt and requirements-extra.txt which | ||
# contain all dependencies needed to run the tests and examples. | ||
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }} | ||
path: .venv | ||
- name: Install system packages | ||
run: sudo apt-get install -y portaudio19-dev | ||
- name: Setup virtual environment | ||
run: | | ||
python -m venv .venv | ||
- name: Install basic Python dependencies | ||
run: | | ||
source .venv/bin/activate | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r requirements-dev.txt | ||
- name: Build project | ||
run: | | ||
source .venv/bin/activate | ||
python -m build | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist | ||
|
||
publish-to-pypi: | ||
name: "Test publish to PyPI" | ||
runs-on: ubuntu-latest | ||
needs: [ build ] | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/dailyai | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ./dist | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: true | ||
print-hash: true | ||
repository-url: https://test.pypi.org/legacy/ |