Skip to content

Commit 36b552f

Browse files
committed
feat(ci): build aarch64 for linux, universal2 for mac, and auto-create releases on tag push
1 parent 31dd055 commit 36b552f

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

.github/workflows/pypi.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Upload to PyPI
33
on:
44
push:
55
tags:
6-
- 'v[0-9]+.*'
7-
- 'test-v[0-9]+.*' # Uploads to https://test.pypi.org/project/tree-sitter/
6+
- "v[0-9]+.*"
7+
- "test-v[0-9]+.*" # Uploads to https://test.pypi.org/project/tree-sitter/
88

99
jobs:
1010
build-sdist:
@@ -15,7 +15,7 @@ jobs:
1515
submodules: true
1616
- uses: actions/setup-python@v4
1717
with:
18-
python-version: '3.10'
18+
python-version: "3.10"
1919
- run: python setup.py sdist
2020
- uses: actions/upload-artifact@v3
2121
with:
@@ -35,7 +35,7 @@ jobs:
3535

3636
- uses: actions/setup-python@v4
3737
with:
38-
python-version: '3.10'
38+
python-version: "3.10"
3939

4040
- if: ${{ startsWith(matrix.os, 'windows') }}
4141
run: script\fetch-fixtures.cmd
@@ -47,7 +47,8 @@ jobs:
4747
- run: python -m cibuildwheel --output-dir dist
4848
env:
4949
CIBW_TEST_COMMAND: python -m unittest discover -s {package}/tests
50-
CIBW_ARCHS_MACOS: x86_64 arm64
50+
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
51+
CIBW_ARCHS_LINUX: x86_64 aarch64
5152

5253
# Make wheels downloadable from GitHub UI and from the pypi step
5354
- uses: actions/upload-artifact@v3
@@ -68,16 +69,29 @@ jobs:
6869

6970
# https://stackoverflow.com/a/58478262
7071
- if: ${{ startsWith(github.ref, 'refs/tags/test-v') }}
71-
name: 'Upload to test.pypi.org'
72+
name: "Upload to test.pypi.org"
7273
uses: pypa/gh-action-pypi-publish@release/v1
7374
with:
7475
user: __token__
7576
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
7677
repository_url: https://test.pypi.org/legacy/
7778

7879
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
79-
name: 'Upload to pypi.org'
80+
name: "Upload to pypi.org"
8081
uses: pypa/gh-action-pypi-publish@release/v1
8182
with:
8283
user: __token__
8384
password: ${{ secrets.PYPI_API_TOKEN }}
85+
86+
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
87+
name: "Create GitHub Release"
88+
uses: actions/create-release@v1
89+
with:
90+
tag_name: ${{ github.ref }}
91+
release_name: ${{ github.ref }}
92+
draft: false
93+
prerelease: false
94+
files: |
95+
dist/*.whl
96+
dist/*.tar.gz
97+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)