Skip to content

Commit

Permalink
Use local image when not pushing
Browse files Browse the repository at this point in the history
  • Loading branch information
abetomo committed Oct 7, 2024
1 parent 1595d2c commit a4b2bb2
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,26 @@ jobs:
if [ ${{ matrix.id }} = "alpine-16" -a "${version}" = "latest" ]; then
tags="${tags},groonga/pgroonga:latest"
fi
platforms="linux/amd64,linux/arm64"
need_load=no
if ! docker manifest inspect ${tag} > /dev/null; then
platforms="linux/amd64"
need_load=yes
fi
echo "DOCKERFILE=${distribution}/${variant}/Dockerfile" >> ${GITHUB_ENV}
echo "DISTRIBUTION=${distribution}" >> ${GITHUB_ENV}
echo "PLATFORMS=${platforms}" >> ${GITHUB_ENV}
echo "PGROONGA_REF=${pgroonga_ref}" >> ${GITHUB_ENV}
echo "POSTGRESQL_VERSION=${postgresql_version}" >> ${GITHUB_ENV}
echo "TAG=${tag}" >> ${GITHUB_ENV}
echo "TAGS=${tags}" >> ${GITHUB_ENV}
echo "VARIANT=${variant}" >> ${GITHUB_ENV}
echo "VERSION=${version}" >> ${GITHUB_ENV}
echo "NEED_LOAD=${need_load}" >> ${GITHUB_ENV}
NEED_PUSH=no
PLATFORMS="linux/amd64"
if [[ "${GITHUB_EVENT_NAME}" = "push" && \
"${GITHUB_REPOSITORY}" = "pgroonga/docker" && \
("${GITHUB_REF_NAME}" = "main" || \
"${GITHUB_REF_TYPE}" = "tag") ]]; then
NEED_PUSH=yes
PLATFORMS="linux/amd64,linux/arm64"
fi
echo "NEED_PUSH=${NEED_PUSH}" >> ${GITHUB_ENV}
echo "PLATFORMS=${PLATFORMS}" >> ${GITHUB_ENV}
- uses: docker/login-action@v3
if: env.NEED_PUSH == 'yes'
with:
Expand All @@ -100,7 +95,7 @@ jobs:
file: ${{ env.DOCKERFILE }}
platforms: ${{ env.PLATFORMS }}
push: ${{ env.NEED_PUSH == 'yes' }}
load: ${{ env.NEED_LOAD == 'yes' }}
load: ${{ env.NEED_PUSH != 'yes' }}
tags: ${{ env.TAGS }}
- name: Image info
if: env.NEED_PUSH == 'yes'
Expand Down

0 comments on commit a4b2bb2

Please sign in to comment.