Skip to content

Commit 7f27724

Browse files
committed
guard jobs with if
1 parent ea8018f commit 7f27724

File tree

2 files changed

+26
-41
lines changed

2 files changed

+26
-41
lines changed

.github/workflows/c.check.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: clang-format
1717
run: find . -type f -iregex ".*\.\(c\|h\|cpp\|ino\)" -exec clang-format -i -style=file {} \; && git diff --exit-code
1818

19-
raspi-source-dist:
19+
raspberry-pi-example-sources:
2020
runs-on: "ubuntu-22.04"
2121
steps:
2222
- uses: actions/checkout@v4
@@ -30,9 +30,9 @@ jobs:
3030
name: raspi-source-dist
3131
path: ./examples/raspberry-pi/*
3232
if-no-files-found: error
33-
build-examples:
33+
build-raspberry-pi-examples:
3434
runs-on: "ubuntu-22.04"
35-
needs: raspi-source-dist
35+
needs: raspberry-pi-example-sources
3636
steps:
3737
- uses: actions/checkout@v4
3838
- uses: actions/download-artifact@v4

.github/workflows/pyhton.build_deploy.yml

+23-38
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
strategy:
5050
matrix:
5151
py-version: ["3.8", "3.9"]
52-
os: [ubuntu-22.04, windows-2019, macOS-13, macOS-15]
52+
os: [ubuntu-22.04, windows-2019, macOS-15]
5353
fail-fast: false
5454
runs-on: ${{ matrix.os }}
5555
needs: generate-wrapper
@@ -158,52 +158,40 @@ jobs:
158158
with:
159159
token: ${{ secrets.GITHUB_TOKEN }}
160160
deploy_pypi:
161-
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
161+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
162162
runs-on: "ubuntu-22.04"
163163
permissions:
164164
id-token: write
165165
needs: ["py3p8_linux_sdist", "build"]
166166
steps:
167-
- uses: actions/checkout@v4
168-
- name: check tag
169-
run: |
170-
echo "TAG_VERSION=$(git describe --tags)" >> $GITHUB_ENV
171-
echo "PKG_VERSION=$(python setup.py --version --quiet | tail -n1)" >> $GITHUB_ENV
172-
echo ${{ env.TAG_VERSION }}
173-
echo ${{ env.PKG_VERSION }}
174-
# if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then echo "Tag Version ($TAG_VERSION) != Package Version ($PKG_VERSION)" && exit 1; fi
175-
# echo "$TAG_VERSION is valid"
176167
- name: download python source dist artifacts
177168
uses: actions/download-artifact@v4
178169
with:
179170
path: python-wrapper/dist
180171
name: py_source_dist
181-
- name: check artifacts after sdist download
182-
run: |
183-
cd python-wrapper/dist
184-
ls -al
185-
- name: download python build artifacts
172+
- name: download win python build artifacts
186173
uses: actions/download-artifact@v4
187174
with:
188175
path: python-wrapper/dist
189176
merge-multiple: true
190-
pattern: py_*_build
191-
- name: check artifacts
192-
run: |
193-
cd python-wrapper/dist
194-
ls -al
195-
#- name: Publish package distributions to PyPI
196-
# uses: pypa/gh-action-pypi-publish@release/v1
197-
# with:
198-
# password: ${{ secrets.PYPI_API_TOKEN }}
199-
177+
pattern: py_*windows*_build
178+
- name: download mac build artifacts
179+
uses: actions/download-artifact@v4
180+
with:
181+
path: python-wrapper/dist
182+
merge-multiple: true
183+
pattern: py_*macOS*_build
184+
# pypi does not accept the linux wheels with _x86_64, thus not uploading any linux wheels
185+
- name: Publish package distributions to PyPI
186+
uses: pypa/gh-action-pypi-publish@release/v1
187+
with:
188+
password: ${{ secrets.PYPI_API_TOKEN }}
200189
github-release:
201190
name: Create GitHub Release and add signature for python packages
202-
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
191+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
203192
needs:
204193
- build
205194
- py3p8_linux_sdist
206-
- deploy_pypi
207195
runs-on: ubuntu-22.04
208196
defaults:
209197
run:
@@ -229,17 +217,15 @@ jobs:
229217
env:
230218
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231219
run: |
232-
echo ${{ github.ref_name }}
233-
# if [[ "$(gh release view '${{ github.ref_name }}' 2>&1)" == "release not found" ]]; then
234-
# gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes ""
235-
# fi
220+
if [[ "$(gh release view '${{ github.ref_name }}' 2>&1)" == "release not found" ]]; then
221+
gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes ""
222+
fi
236223
- name: Upload artifacts to GitHub Release
237224
env:
238225
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
239226
# Upload release artifacts before the signing, such that artifacts are still uploaded if signing fails
240-
run: |
241-
ls -al dist/**
242-
# gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
227+
run: |
228+
gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
243229
- name: Sign the dists with Sigstore
244230
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46
245231
with:
@@ -250,6 +236,5 @@ jobs:
250236
env:
251237
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
252238
# upload sigstore-produced signatures and certificates from dist
253-
run: |
254-
ls -al dist/*.sigstore.json
255-
# gh release upload '${{ github.ref_name }}' dist/*.sigstore.json --repo '${{ github.repository }}'
239+
run: |
240+
gh release upload '${{ github.ref_name }}' dist/*.sigstore.json --repo '${{ github.repository }}'

0 commit comments

Comments
 (0)