generated from aaivu/aaivu-project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (52 loc) · 1.68 KB
/
wheel-builder.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build Wheel on PR
on:
pull_request:
types: [opened, synchronize]
jobs:
build:
if: "contains(github.event.head_commit.message, '[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/