.github/workflows/publish-python.yml #29
Workflow file for this run
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
name: Publish Python | |
on: | |
workflow_dispatch: | |
jobs: | |
publish_wheels: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- python-version: '3.11' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Tooling | |
run: | | |
pip install poetry | |
pip install --user tox | |
pip install --user twine | |
- name: Extract Yggdrasil Core Version | |
run: | | |
cd python-engine | |
CORE_VERSION=$(python3 -c "import yggdrasil_engine;print(yggdrasil_engine.__yggdrasil_core_version__)") | |
echo "FFI Library Version: $CORE_VERSION" | |
echo "CORE_VERSION=$CORE_VERSION" >> $GITHUB_ENV | |
- name: Set up Binary List | |
run: | | |
# List of binaries we want to download | |
binaries=( | |
"libyggdrasilffi_x86_64.so" | |
"libyggdrasilffi_arm64.so" | |
"libyggdrasilffi_x86_64-musl.so" | |
"libyggdrasilffi_arm64-musl.so" | |
"yggdrasilffi_x86_64.dll" | |
"yggdrasilffi_arm64.dll" | |
"libyggdrasilffi_x86_64.dylib" | |
"libyggdrasilffi_arm64.dylib" | |
) | |
echo "binaries=${binaries[@]}" >> $GITHUB_ENV | |
- name: Download All Binaries | |
run: | | |
TARGET_DIR="python-engine/binaries" | |
mkdir -p "$TARGET_DIR" | |
for binary in ${binaries[@]}; do | |
echo "Downloading $binary..." | |
curl -L -o "$TARGET_DIR/$binary" \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
"https://github.com/${{ github.repository }}/releases/download/unleash-yggdrasil-v${CORE_VERSION}/$binary" | |
if [ -f "$TARGET_DIR/$binary" ]; then | |
echo "$binary downloaded successfully." | |
else | |
echo "Error: $binary could not be downloaded." | |
exit 1 | |
fi | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build wheels | |
run: | | |
cd python-engine | |
poetry install | |
tox | |
- name: Publish wheels | |
run: | | |
cd python-engine | |
twine upload staging/* | |
env: | |
TWINE_USERNAME: '__token__' | |
TWINE_PASSWORD: ${{ secrets.PYPI_PUBLISH_KEY }} |