Skip to content

Update GOPHER_ORCH_VERSION to v0.1.0-20260208-150923 #5

Update GOPHER_ORCH_VERSION to v0.1.0-20260208-150923

Update GOPHER_ORCH_VERSION to v0.1.0-20260208-150923 #5

name: Publish Python Packages
on:
push:
env:
GOPHER_ORCH_VERSION: v0.1.0-20260208-150923
PACKAGE_VERSION: 0.1.0.dev20260208150923
DRY_RUN: false
jobs:
download-binaries:
name: Download gopher-orch binaries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all release assets
env:
GH_TOKEN: ${{ secrets.GOPHER_ORCH_TOKEN }}
run: |
# Download all assets from the private gopher-orch repo
gh release download ${{ env.GOPHER_ORCH_VERSION }} \
-R GopherSecurity/gopher-orch \
-D downloads
# Extract to platform-specific directories
mkdir -p artifacts/linux-x64 artifacts/linux-arm64
mkdir -p artifacts/darwin-x64 artifacts/darwin-arm64
mkdir -p artifacts/win32-x64 artifacts/win32-arm64
tar -xzf downloads/libgopher-orch-linux-x64.tar.gz -C artifacts/linux-x64
tar -xzf downloads/libgopher-orch-linux-arm64.tar.gz -C artifacts/linux-arm64
tar -xzf downloads/libgopher-orch-macos-x64.tar.gz -C artifacts/darwin-x64
tar -xzf downloads/libgopher-orch-macos-arm64.tar.gz -C artifacts/darwin-arm64
unzip -o downloads/libgopher-orch-windows-x64.zip -d artifacts/win32-x64
unzip -o downloads/libgopher-orch-windows-arm64.zip -d artifacts/win32-arm64
- name: List downloaded artifacts
run: |
echo "=== Downloaded artifacts ==="
find artifacts -type f \( -name "*.so" -o -name "*.dylib" -o -name "*.dll" \) | head -20
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: native-binaries
path: artifacts/
retention-days: 1
publish-platform-packages:
name: Publish ${{ matrix.platform }} package
needs: download-binaries
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
include:
- platform: darwin-arm64
lib_pattern: "*.dylib"
pkg_name: gopher_orch_native_darwin_arm64
- platform: darwin-x64
lib_pattern: "*.dylib"
pkg_name: gopher_orch_native_darwin_x64
- platform: linux-arm64
lib_pattern: "*.so*"
pkg_name: gopher_orch_native_linux_arm64
- platform: linux-x64
lib_pattern: "*.so*"
pkg_name: gopher_orch_native_linux_x64
- platform: win32-arm64
lib_pattern: "*.dll"
pkg_name: gopher_orch_native_win32_arm64
- platform: win32-x64
lib_pattern: "*.dll"
pkg_name: gopher_orch_native_win32_x64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: |
pip install build twine
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: native-binaries
path: artifacts/
- name: Copy binaries to package
run: |
PKG_DIR="packages/${{ matrix.platform }}/${{ matrix.pkg_name }}/lib"
mkdir -p "$PKG_DIR"
# Copy library files (handle various directory structures)
# Check lib/ directory
if [ -d "artifacts/${{ matrix.platform }}/lib" ]; then
cp artifacts/${{ matrix.platform }}/lib/${{ matrix.lib_pattern }} "$PKG_DIR/" 2>/dev/null || true
fi
# Check bin/ directory (Windows DLLs might be here)
if [ -d "artifacts/${{ matrix.platform }}/bin" ]; then
cp artifacts/${{ matrix.platform }}/bin/${{ matrix.lib_pattern }} "$PKG_DIR/" 2>/dev/null || true
fi
# Check flat structure
cp artifacts/${{ matrix.platform }}/${{ matrix.lib_pattern }} "$PKG_DIR/" 2>/dev/null || true
# List what we copied
echo "=== Package contents for ${{ matrix.platform }} ==="
ls -la "$PKG_DIR/"
- name: Update package version
run: |
cd packages/${{ matrix.platform }}
# Update version in pyproject.toml
sed -i "s/version = \".*\"/version = \"${{ env.PACKAGE_VERSION }}\"/" pyproject.toml
# Update version in __init__.py
sed -i "s/__version__ = \".*\"/__version__ = \"${{ env.PACKAGE_VERSION }}\"/" ${{ matrix.pkg_name }}/__init__.py
echo "Updated pyproject.toml:"
cat pyproject.toml
- name: Build package
run: |
cd packages/${{ matrix.platform }}
python -m build
- name: Publish to TestPyPI
if: ${{ env.DRY_RUN != 'true' }}
run: |
cd packages/${{ matrix.platform }}
twine upload --repository testpypi --skip-existing dist/* --username __token__ --password ${{ secrets.TEST_PYPI_TOKEN }}
- name: Dry run - show package contents
if: ${{ env.DRY_RUN == 'true' }}
run: |
cd packages/${{ matrix.platform }}
echo "=== Would publish package ==="
cat pyproject.toml
echo ""
echo "=== Built packages ==="
ls -la dist/
publish-main-package:
name: Publish main package
needs: publish-platform-packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: |
pip install build twine
- name: Update package version
run: |
# Update version in pyproject.toml
sed -i "s/version = \".*\"/version = \"${{ env.PACKAGE_VERSION }}\"/" pyproject.toml
# Update version in __init__.py
sed -i "s/__version__ = \".*\"/__version__ = \"${{ env.PACKAGE_VERSION }}\"/" gopher_orch/__init__.py
echo "Updated pyproject.toml:"
grep version pyproject.toml
- name: Build package
run: |
python -m build
- name: Publish to TestPyPI
if: ${{ env.DRY_RUN != 'true' }}
run: |
twine upload --repository testpypi --skip-existing dist/* --username __token__ --password ${{ secrets.TEST_PYPI_TOKEN }}
- name: Dry run - show package info
if: ${{ env.DRY_RUN == 'true' }}
run: |
echo "=== Would publish main package ==="
cat pyproject.toml
echo ""
echo "=== Built packages ==="
ls -la dist/