Skip to content

Generate wheels on every commit #415

Generate wheels on every commit

Generate wheels on every commit #415

Workflow file for this run

name: Python wheel
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wheel
path: ./dist/*.whl
- name: Publish wheels to orphan `wheels` branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create a fresh working directory
rm -rf wheels-branch
mkdir wheels-branch
cd wheels-branch
# Initialize git repo
git init
git remote add origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
git fetch origin wheels || true
# Create orphan branch
git checkout --orphan wheels
git reset --hard
# Copy wheels
mkdir -p wheels
cp ./dist/*.whl wheels/
echo "Wheels to publish:"
ls -lh wheels/
# Commit
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add wheels
git commit -m "Update wheels for release ${{ github.ref_name }}"
# Force push
git push origin wheels --force