Skip to content

Commit

Permalink
Merge pull request #3314 from infotroph/update-only-if-exist-ci
Browse files Browse the repository at this point in the history
build depends fresh if no existing tag to update
  • Loading branch information
infotroph authored Jun 25, 2024
2 parents 9b37c5f + 5037d84 commit 1a8f607
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,22 @@ jobs:
echo "PECAN_TAGS=develop" >> $GITHUB_ENV
fi
# If any dependencies changed in this PR, try to update depends image
# Only runs on pull_request -- others it's not clear what base to compare to
- name: check for changed dependencies
if: github.base_ref != ''
uses: dorny/paths-filter@v3
id: findchanges
with:
filters: |
deps:
- docker/depends/**
- if: steps.findchanges.outputs.deps == 'true'
run: echo "UPDATE_DEPENDS_FROM_TAG=${GITHUB_BASE_REF##*/}" >> $GITHUB_ENV
# NB: GITHUB_BASE_REF is only set on pull requests,
# so non-PR builds will find no existing tag and build fresh
run: |
if $(docker manifest inspect pecan/depends:${GITHUB_BASE_REF##*/} > /dev/null 2>&1); then
echo "UPDATE_DEPENDS_FROM_TAG=${GITHUB_BASE_REF##*/}" >> $GITHUB_ENV
else
echo "BUILD_DEPENDS_FRESH=true" >> GITHUB_ENV
fi
env:
GITHUB_BASE_REF: ${{ github.base_ref }}
# use shell script to build, there is some complexity in this
Expand All @@ -94,6 +99,7 @@ jobs:
PECAN_GIT_BRANCH: ${GITHUB_BRANCH}
VERSION: ${{ env.PECAN_VERSION }}
UPDATE_DEPENDS_FROM_TAG: ${{ env.UPDATE_DEPENDS_FROM_TAG }}
BUILD: ${{ env.BUILD_DEPENDS_FRESH }}

# push all images to github
- name: Publish to GitHub
Expand Down

0 comments on commit 1a8f607

Please sign in to comment.