-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GitHub Action workflow to build and release the Python wheels
- Loading branch information
1 parent
82cb2c1
commit c8dbccd
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
name: Build and Release Python Wheels | ||
|
||
on: | ||
release: | ||
types: [published] | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0.0, v2.0.0, ... | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] | ||
architecture: [x64] | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: ${{ matrix.architecture }} | ||
cache: 'pip' | ||
|
||
- name: Install Rust | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build wheel | ||
run: | | ||
python -m build | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: tt-flash-whl-${{ matrix.python-version }}-${{ matrix.architecture }} | ||
path: | | ||
./dist/*.whl | ||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: artifacts/ | ||
|
||
- name: Move Wheel Files | ||
run: | | ||
mkdir -p wheels | ||
find artifacts -name '*.whl' -exec mv {} wheels/ \; | ||
- name: Upload Wheel Files | ||
run: | | ||
cd wheels | ||
ls -la | ||
for wheel in *.whl; do | ||
if [ -f "$wheel" ]; then | ||
echo "Uploading $wheel" | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: application/octet-stream" \ | ||
"${{ github.event.release.upload_url }}=$(basename "$wheel")" \ | ||
--data-binary "@$wheel" | ||
fi | ||
done | ||
# - name: Publish package | ||
# uses: pypa/[email protected] | ||
# with: | ||
# user: __token__ | ||
# password: ${{ secrets.PYPI_API_TOKEN }} |