Skip to content

Commit bc0b7ce

Browse files
- Login correction.
1 parent 56b8dec commit bc0b7ce

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,12 @@ jobs:
12411241
run: |
12421242
docker compose -f docker-compose-credentials.yml build credentialsgen
12431243
docker compose build mockserver
1244+
1245+
- name: Login to Docker Hub
1246+
uses: docker/login-action@v3
1247+
with:
1248+
username: ${{ secrets.DOCKERHUB_USERNAME }}
1249+
password: ${{ secrets.DOCKERHUB_TOKEN }}
12441250

12451251
- name: Build Stackql image with buildx
12461252
uses: docker/build-push-action@v6
@@ -1362,23 +1368,54 @@ jobs:
13621368
needs:
13631369
- dockerbuild
13641370
steps:
1371+
1372+
- name: Image env sanitize
1373+
run: |
1374+
PUSH_IMAGE_REQUIRED="false"
1375+
# shellcheck disable=SC2235
1376+
if ( \
1377+
[ "${{ github.repository }}" = "stackql/stackql" ] \
1378+
|| [ "${{ github.repository }}" != "stackql/stackql-devel" ] \
1379+
) \
1380+
&& [ "${{ vars.CI_SKIP_DOCKER_PUSH }}" != "true" ] \
1381+
&& [ "$( grep '^build-elide.*' <<< '${{ github.ref_name }}' )" = "" ] \
1382+
&& ( \
1383+
[ "${{ github.ref_type }}" = "branch" ] \
1384+
&& [ "${{ github.ref_name }}" = "main" ] \
1385+
&& [ "${{ github.event_name }}" = "push" ] \
1386+
) \
1387+
|| ( \
1388+
[ "${{ github.ref_type }}" = "tag" ] \
1389+
&& [ "$( grep '^build-release.*' <<< '${{ github.ref_name }}' )" != "" ] \
1390+
); \
1391+
then
1392+
PUSH_IMAGE_REQUIRED="true"
1393+
fi
1394+
{
1395+
echo "PUSH_IMAGE_REQUIRED=${PUSH_IMAGE_REQUIRED}";
1396+
} | tee -a "${GITHUB_ENV}"
1397+
13651398
- name: Download digests
13661399
uses: actions/download-artifact@v4
1400+
if: env.PUSH_IMAGE_REQUIRED == 'true'
13671401
with:
13681402
path: ${{ runner.temp }}/digests
13691403
pattern: digests-*
13701404
merge-multiple: true
1371-
1405+
13721406
- name: Login to Docker Hub
13731407
uses: docker/login-action@v3
1408+
if: env.PUSH_IMAGE_REQUIRED == 'true'
13741409
with:
1375-
username: ${{ vars.DOCKERHUB_USERNAME }}
1410+
username: ${{ secrets.DOCKERHUB_USERNAME }}
13761411
password: ${{ secrets.DOCKERHUB_TOKEN }}
13771412

13781413
- name: Set up Docker Buildx
1414+
if: env.PUSH_IMAGE_REQUIRED == 'true'
13791415
uses: docker/setup-buildx-action@v3
13801416

13811417
- name: Docker meta
1418+
if: env.PUSH_IMAGE_REQUIRED == 'true'
13821419
id: meta
13831420
uses: docker/metadata-action@v5
13841421
with:
@@ -1394,13 +1431,15 @@ jobs:
13941431
type=raw,value=${{ github.sha }}
13951432
13961433
- name: Create manifest list and push
1434+
if: env.PUSH_IMAGE_REQUIRED == 'true'
13971435
working-directory: ${{ runner.temp }}/digests
13981436
run: |
13991437
# shellcheck disable=SC2046
14001438
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
14011439
$(printf '${{ env.STACKQL_IMAGE_NAME }}@sha256:%s ' *)
14021440
14031441
- name: Inspect image
1442+
if: env.PUSH_IMAGE_REQUIRED == 'true'
14041443
run: |
14051444
docker buildx imagetools inspect ${{ env.STACKQL_IMAGE_NAME }}:${{ steps.meta.outputs.version }}
14061445

0 commit comments

Comments
 (0)