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