Update push-docker.yml (#38)

This commit is contained in:
Anthony Stirling 2023-02-05 23:35:49 +00:00 committed by GitHub
parent 57b12ffcc3
commit 53057f4e18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 5 deletions

View file

@ -4,6 +4,7 @@ on:
push: push:
branches: branches:
- master - master
- testGit
- main - main
jobs: jobs:
push: push:
@ -38,19 +39,35 @@ 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
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: Setup buildx - name: Setup buildx
if: steps.checkIdExists.outcome != 'failure'
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 - name: Build and push versioned amd64 and v8
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main' && steps.checkIdExists.outcome != 'failure'
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 }}" .
- name: Build and push latest amd64 and v8 - name: Build and push latest amd64 and v8
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master' && steps.checkIdExists.outcome != 'failure'
run: | run: |
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:latest" . docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:latest" .

View file

@ -5,7 +5,7 @@ plugins {
} }
group = 'stirling.software' group = 'stirling.software'
version = '0.3.1' version = '0.3.2'
sourceCompatibility = '17' sourceCompatibility = '17'
repositories { repositories {