Skip to content

Commit 159bb05

Browse files
First draft of new build for automatic release
1 parent db38287 commit 159bb05

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

.github/workflows/build.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Adapted from example at
2+
# https://github.com/pypa/cibuildwheel/blob/0319c431dedc020eb/examples/github-deploy.yml
3+
#
4+
# Original license:
5+
#
6+
# This project is licensed under the 'BSD 2-clause license'.
7+
#
8+
# Copyright (c) 2017-2023, Joe Rickerby and contributors. All rights reserved.
9+
#
10+
# Redistribution and use in source and binary forms, with or without
11+
# modification, are permitted provided that the following conditions are met:
12+
#
13+
# 1. Redistributions of source code must retain the above copyright notice, this
14+
# list of conditions and the following disclaimer.
15+
#
16+
# 2. Redistributions in binary form must reproduce the above copyright notice,
17+
# this list of conditions and the following disclaimer in the documentation
18+
# and/or other materials provided with the distribution.
19+
#
20+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
name: Build (and upload to PyPI for published releases)
32+
33+
on:
34+
workflow_dispatch:
35+
pull_request:
36+
push:
37+
branches:
38+
- main
39+
- automatic_release
40+
release:
41+
types:
42+
- published
43+
44+
jobs:
45+
build_wheels:
46+
name: Build wheels on ${{ matrix.os }}
47+
runs-on: ${{ matrix.os }}
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
os: [ubuntu-latest, macos-latest]
52+
53+
steps:
54+
- uses: actions/checkout@v5.0.0
55+
with:
56+
fetch-depth: 0
57+
fetch-tags: true
58+
- name: Build wheels
59+
uses: pypa/cibuildwheel@v3.1.4
60+
- uses: actions/upload-artifact@v4
61+
with:
62+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
63+
path: ./wheelhouse/*.whl
64+
65+
# upload_test_pypi:
66+
# needs: [build_wheels]
67+
# runs-on: ubuntu-latest
68+
# environment: test-pypi
69+
# permissions:
70+
# id-token: write
71+
# if: |
72+
# (github.event_name == 'release' && github.event.action == 'published') ||
73+
# (github.event_name == 'push' && github.ref == 'refs/heads/main')
74+
# steps:
75+
# - uses: actions/download-artifact@v5
76+
# with:
77+
# # Unpack all CIBW artifacts (wheels + sdist) into dist/
78+
# # pypa/gh-action-pypi-publish action uploads contents of dist/ unconditionally
79+
# pattern: cibw-*
80+
# path: dist
81+
# merge-multiple: true
82+
# # Try publishing to Test PyPI first - if there are issues this should
83+
# # cause job to fail before attempting to publish on PyPI itself
84+
# - name: Publish package distribution to Test PyPI
85+
# uses: pypa/gh-action-pypi-publish@release/v1
86+
# with:
87+
# repository-url: https://test.pypi.org/legacy/
88+
89+
# upload_pypi:
90+
# needs: [build_wheels, build_sdist, upload_test_pypi]
91+
# runs-on: ubuntu-latest
92+
# environment: pypi
93+
# permissions:
94+
# id-token: write
95+
# if: github.event_name == 'release' && github.event.action == 'published'
96+
# steps:
97+
# - uses: actions/download-artifact@v5
98+
# with:
99+
# pattern: cibw-*
100+
# path: dist
101+
# merge-multiple: true
102+
# - name: Publish package distribution to PyPI
103+
# uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)