Skip to content

Commit 170670e

Browse files
authored
ci: rolling: only release if needed (#5)
1 parent 406d44c commit 170670e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/rolling.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,24 @@ jobs:
4747
sparse-checkout: |
4848
schema.yml
4949
sparse-checkout-cone-mode: false
50+
- id: changes
51+
name: Check for changes
52+
run: |
53+
if git diff --exit-code -- schema.yml > /dev/null; then
54+
echo "schema_has_changes=false" >> "$GITHUB_OUTPUT"
55+
else
56+
echo "schema_has_changes=true" >> "$GITHUB_OUTPUT"
57+
fi
5058
- name: Publish to GitHub
59+
if: "${{ steps.changes.outputs.schema_has_changes == 'true' }}"
5160
working-directory: client-python
5261
env:
5362
GH_TOKEN: ${{ steps.app-token.outputs.token }}
5463
run: |
64+
git diff --exit-code schema.yml && exit 0 || echo
65+
5566
version="$(yq -r '.info.version' schema.yml)-$(date +%s)"
5667
make version="$version"
57-
[ "$(wc -l < diff.test)" -lt 4 ] && exit 0 || echo
5868
5969
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
6070
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
@@ -67,10 +77,12 @@ jobs:
6777
truncate -s '<125000' diff.test
6878
gh release create v$version -F diff.test --prerelease
6979
- name: Build package
80+
if: "${{ steps.changes.outputs.schema_has_changes == 'true' }}"
7081
working-directory: client-python
7182
run: |
7283
poetry build
7384
- name: Publish to PyPi
85+
if: "${{ steps.changes.outputs.schema_has_changes == 'true' }}"
7486
uses: pypa/gh-action-pypi-publish@release/v1
7587
with:
7688
packages-dir: client-python/dist/

0 commit comments

Comments
 (0)