Skip to content

Commit f9e210e

Browse files
committed
guard jobs with if
1 parent ea8018f commit f9e210e

File tree

2 files changed

+17
-38
lines changed

2 files changed

+17
-38
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

+14-35
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,48 +158,30 @@ 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
185172
- name: download python build artifacts
186173
uses: actions/download-artifact@v4
187174
with:
188175
path: python-wrapper/dist
189176
merge-multiple: true
190177
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-
178+
- name: Publish package distributions to PyPI
179+
uses: pypa/gh-action-pypi-publish@release/v1
180+
with:
181+
password: ${{ secrets.PYPI_API_TOKEN }}
200182
github-release:
201183
name: Create GitHub Release and add signature for python packages
202-
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
184+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
203185
needs:
204186
- build
205187
- py3p8_linux_sdist
@@ -229,17 +211,15 @@ jobs:
229211
env:
230212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231213
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
214+
if [[ "$(gh release view '${{ github.ref_name }}' 2>&1)" == "release not found" ]]; then
215+
gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes ""
216+
fi
236217
- name: Upload artifacts to GitHub Release
237218
env:
238219
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
239220
# 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 }}'
221+
run: |
222+
gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
243223
- name: Sign the dists with Sigstore
244224
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46
245225
with:
@@ -250,6 +230,5 @@ jobs:
250230
env:
251231
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
252232
# 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 }}'
233+
run: |
234+
gh release upload '${{ github.ref_name }}' dist/*.sigstore.json --repo '${{ github.repository }}'

0 commit comments

Comments
 (0)