Skip to content

Update README.md (#45) #50

Update README.md (#45)

Update README.md (#45) #50

name: Release on TestPyPI
on:
push:
branches:
- main
tags-ignore:
- "**" # Do not run on tags push
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_TOKEN }}
jobs:
publish-core:
runs-on: ubuntu-latest
environment: PyPI Publisher
permissions:
id-token: write
outputs:
list_plugins: ${{ steps.list_plugins.outputs.value }}
steps:
- uses: actions/checkout@v4
- name: List plugins
id: list_plugins
run: |
git fetch origin main
echo "value=$(./.github/workflows/scripts/get_affected_folders.sh)" >> $GITHUB_OUTPUT
- name: "Print plugins list"
run: |
echo "${{ steps.list_plugins.outputs.value }}"
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
sudo apt-get install portaudio19-dev
pip install uv
uv pip install --system hatch intentional-core/ intentional/
- name: Build intentional-core wheel
run: |
cd intentional-core/
hatch version patch,dev
hatch version "$(hatch version)$(date +%s)"
hatch build
- name: Publish intentional-core to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: intentional-core/dist/
- name: Build intentional wheel
run: |
cd intentional/
hatch version patch,dev
hatch version "$(hatch version)$(date +%s)"
hatch build
- name: Publish intentional to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: intentional/dist/
build-wheels:
needs:
- publish-core
outputs:
artifact_id: ${{ steps.artifact_id.outputs.value }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Generate artifact_id string
id: artifact_id
run: echo "value=$(cksum <<< $(git branch --show-current) | cut -f 1 -d ' ').$(date +%s)" >> $GITHUB_OUTPUT
- name: "Print generated artifact_id string"
run: |
echo "${{ steps.artifact_id.outputs.value }}"
- name: Install dependencies
run: |
pip install uv
uv pip install --system hatch intentional-core/
- name: Build plugins wheels
run: |
mkdir wheels/
cd intentional-core/
hatch version patch,dev
hatch version "$(hatch version)$(date +%s)"
hatch build
mv dist/*.whl ../wheels/
cd ../
cd intentional/
hatch version patch,dev
hatch version "$(hatch version)$(date +%s)"
hatch build
mv dist/*.whl ../wheels/
cd ../
cd plugins/
for folder in $(ls); do
# Only cd into folders that are directories and start with "intentional-"
if [ -d "$folder" ] && [[ "$folder" == intentional-* ]]; then
cd $folder
hatch version patch,dev
hatch version "$(hatch version)$(date +%s)"
hatch build
mv dist/*.whl ../../wheels/
cd ..
fi
done
- name: Archive wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ steps.artifact_id.outputs.value }}
path: wheels
publish-plugins:
needs:
- publish-core
- build-wheels
runs-on: ubuntu-latest
environment: PyPI Publisher
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
plugin: ${{fromJson(needs.publish-core.outputs.list_plugins)}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Download wheels
uses: actions/download-artifact@v4
with:
name: wheels-${{ needs.build-wheels.outputs.artifact_id }}
path: wheels/
- name: Install dependencies
run: |
sudo apt-get install portaudio19-dev
pip install uv
uv pip install --system hatch plugins/${{ matrix.plugin }} --find-links=./wheels/ --extra-index-url=https://pypi.org/simple
- name: Build plugin wheel
run: |
cd plugins/${{ matrix.plugin }}
hatch version patch,dev
hatch version "$(hatch version)$(date +%s)"
hatch build
- name: Publish plugin to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: plugins/${{ matrix.plugin }}/dist/