Skip to content

ci: Add wheel file builder on PRs #9

ci: Add wheel file builder on PRs

ci: Add wheel file builder on PRs #9

Workflow file for this run

name: Build Wheel on PR
on:
pull_request:
types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.x"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build wheel
run: |
python setup.py sdist bdist_wheel
mkdir -p wheel_files
cp dist/*.whl wheel_files/
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and push changes
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git add wheel_files/
git commit -m "Add new wheel file"
git push origin ${GITHUB_REF#refs/heads/}
- name: Rename wheel file
run: |
PR_NUMBER=${{ github.event.number }}
ATTEMPT_NUMBER=${{ github.run_attempt }}
for f in wheel_files/*.whl; do
base_name=$(basename "$f" .whl)
new_name="${base_name}-PR-${PR_NUMBER}.${ATTEMPT_NUMBER}.whl"
mv "$f" "wheel_files/$new_name"
done
- name: Upload wheel file
uses: actions/upload-artifact@v3
with:
name: wheel_files
path: wheel_files/