Skip to content

Commit

Permalink
ci: Add wheel file builder on PRs (#11)
Browse files Browse the repository at this point in the history
* ci: Add wheel file builder on PRs

* Fix python version

* Fix python version

* Fix python version

* Update the workflow

* Update the workflow

* Fix the updated workflow

* Fix the updated workflow

* Test commit

* Test commit

* Test commit

* Skip the step `Commit and push changes`

* Include the step `Commit and push changes`

* Include the step `Commit and push changes`

* Include the step `Commit and push changes`

* Include the step `Commit and push changes`

* Include the step `Commit and push changes`

* Include the step `Commit and push changes`

* Add new wheel file

* Include `skip ci` to avoid infinite loop

* Add new wheel file [skip ci]

* build: Create whl file

* Create whl file [build]

* build: Create whl file

* [build] Create whl file

* Update

* Delete wheel_files folder

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
kajanan1212 and github-actions[bot] authored May 23, 2024
1 parent 02014e7 commit 7b29ef8
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/wheel-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build Wheel on PR

on:
pull_request:
types: [opened, synchronize]

jobs:
build:
if: contains(github.event.pull_request.title, "build") || contains(github.event.pull_request.body, "build")
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- 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 fetch origin
git checkout ${GITHUB_HEAD_REF}
git pull origin ${GITHUB_HEAD_REF}
git add wheel_files/
git commit -m "Add new wheel file"
git push "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git" HEAD:${{ github.head_ref }}
- 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/

0 comments on commit 7b29ef8

Please sign in to comment.