diff --git a/.github/workflows/docker-image-push.yml b/.github/workflows/docker-image-push.yml index 4949e83..7e0e658 100644 --- a/.github/workflows/docker-image-push.yml +++ b/.github/workflows/docker-image-push.yml @@ -22,11 +22,13 @@ jobs: tag_name=$(curl -sH "Authorization: token $API_TOKEN" https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest | jq -r '.tag_name' | cut -c2-) echo "tag=$tag_name" >> $GITHUB_OUTPUT - echo $tag_name + echo "tag=$tag_name" check_image_tag: runs-on: ubuntu-latest needs: latest_version + outputs: + image_exists: ${{ steps.check_image.outputs.image_exists }} steps: - name: Check image tag exists id: check_image @@ -35,33 +37,33 @@ jobs: run: | IMAGE_NAME="hakindazz/s6-overlay-base" docker pull "$IMAGE_NAME:$LATEST_TAG" &> /dev/null -# if [ $? -eq 0 ]; then -# echo "image_exists=true" >> $GITHUB_OUTPUT -# else -# echo "image_exists=false" >> $GITHUB_OUTPUT -# fi -# -# build-and-push: -# runs-on: ubuntu-latest -# needs: [latest_version, check_image_tag] -# if: "!needs.check_image_tag.outputs.image_exists" -# steps: -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v3 -# -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v3 -# -# - name: Login to Docker Hub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# -# - name: Build and push -# uses: docker/build-push-action@v6 -# with: -# push: true -# tags: | -# hakindazz/s6-overlay-base:latest -# hakindazz/s6-overlay-base:${{ needs.latest_version.outputs.tag }} + if [ $? -eq 0 ]; then + echo "image_exists=true" >> $GITHUB_OUTPUT + else + echo "image_exists=false" >> $GITHUB_OUTPUT + fi + + build-and-push: + runs-on: ubuntu-latest + needs: [latest_version, check_image_tag] + if: "!needs.check_image_tag.outputs.image_exists" + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: | + hakindazz/s6-overlay-base:latest + hakindazz/s6-overlay-base:${{ needs.latest_version.outputs.tag }}