Update push-docker.yml

This commit is contained in:
Anthony Stirling 2023-02-06 12:39:26 +00:00 committed by GitHub
parent e40e47df7d
commit f7d320ac32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,18 +39,18 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_API }} password: ${{ secrets.DOCKER_HUB_API }}
- name: Check if tag exists # - name: Check if tag exists
id: checkIdExists # id: checkIdExists
continue-on-error: true # continue-on-error: true
run: | # run: |
response=$(curl -s https://hub.docker.com/v2/repositories/frooodle/s-pdf/tags/?name=${{ steps.versionNumber.outputs.versionNumber }}) # response=$(curl -s https://hub.docker.com/v2/repositories/frooodle/s-pdf/tags/?name=${{ steps.versionNumber.outputs.versionNumber }})
result=$(echo $response | jq ".results") # result=$(echo $response | jq ".results")
if [ "$result" == "[]" ]; then # if [ "$result" == "[]" ]; then
echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} doesnt exist. Continuing with build and push." # echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} doesnt exist. Continuing with build and push."
else # else
echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} already exists. Skipping build and push." # echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} already exists. Skipping build and push."
exit 1; # exit 1;
fi # fi
@ -58,9 +58,15 @@ jobs:
run: | run: |
docker buildx create --name mybuilder docker buildx create --name mybuilder
docker buildx use mybuilder docker buildx use mybuilder
- name: Build and push versioned amd64 and v8
if: github.ref == 'refs/heads/main'
run: |
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}-alpha" .
- name: Build and push versioned amd64 and v8 - name: Build and push versioned amd64 and v8
if: github.ref == 'refs/heads/main' && steps.checkIdExists.outcome != 'failure' if: github.ref == 'refs/heads/master'
run: | run: |
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}" . docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}" .