abort workflow early if no diff

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2025-05-26 14:12:24 -04:00
parent c90e3ae585
commit 285f71e8a3
No known key found for this signature in database
GPG Key ID: 47940175096C1330

View File

@ -38,29 +38,30 @@ jobs:
wget --content-disposition -nv "$DETERMINATE_URL" wget --content-disposition -nv "$DETERMINATE_URL"
git diff --quiet git diff --quiet
echo "new_binary=$?" >> "$GITHUB_OUTPUT" echo "DETERMINATE_BINARY_DIFF=$?" | tee -a "$GITHUB_OUTPUTS"
env: env:
DETERMINATE_URL: ${{ env.DETERMINATE_URL }} DETERMINATE_URL: ${{ env.DETERMINATE_URL }}
update-tags:
if: steps.download-binary.outputs.new_binary != 0
steps:
- name: Git config - name: Git config
if: steps.download-binary.outputs.DETERMINATE_BINARY_DIFF != 0
run: | run: |
git config user.name github-actions git config user.name github-actions
git config user.email github-actions@github.com git config user.email github-actions@github.com
- name: Commit binary - name: Commit binary
if: steps.download-binary.outputs.DETERMINATE_BINARY_DIFF != 0
run: | run: |
git add . git add .
git commit -m "automated download workflow" git commit -m "automated download workflow"
commit_id=$(git rev-parse HEAD) commit_id=$(git rev-parse HEAD)
echo "COMMIT_ID=$(echo $commit_id)" >> $GITHUB_ENV echo "COMMIT_ID=$(echo $commit_id)" >> $GITHUB_ENV
- name: Tag new target - name: Tag new target
if: steps.download-binary.outputs.DETERMINATE_BINARY_DIFF != 0
run: | run: |
git tag -f "$DETERMINATE_VERSION" "$COMMIT_ID" git tag -f "$DETERMINATE_VERSION" "$COMMIT_ID"
env: env:
DETERMINATE_VERSION: ${{ env.DETERMINATE_VERSION }} DETERMINATE_VERSION: ${{ env.DETERMINATE_VERSION }}
COMMIT_ID: ${{ env.COMMIT_ID }} COMMIT_ID: ${{ env.COMMIT_ID }}
- name: Push new tag - name: Push new tag
if: steps.download-binary.outputs.DETERMINATE_BINARY_DIFF != 0
run: | run: |
git push origin "$DETERMINATE_VERSION" --force git push origin "$DETERMINATE_VERSION" --force
git checkout main git checkout main
@ -69,6 +70,7 @@ jobs:
env: env:
DETERMINATE_VERSION: ${{ env.DETERMINATE_VERSION }} DETERMINATE_VERSION: ${{ env.DETERMINATE_VERSION }}
- name: Publish release - name: Publish release
if: steps.download-binary.outputs.DETERMINATE_BINARY_DIFF != 0
uses: akkuman/gitea-release-action@v1 uses: akkuman/gitea-release-action@v1
env: env:
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18 NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18