1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-06 07:50:11 +01:00
Stirling-PDF/.github/workflows/push-docker.yml

75 lines
2.2 KiB
YAML
Raw Normal View History

name: Push Docker Image with VersionNumber
on:
push:
branches:
- master
2023-02-06 00:35:49 +01:00
- testGit
- main
jobs:
2023-01-29 19:41:33 +01:00
push:
runs-on: ubuntu-latest
steps:
2023-01-30 21:56:22 +01:00
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: gradle/gradle-build-action@v2.3.3
with:
gradle-version: 7.6
arguments: clean build
- name: Make Gradle wrapper executable
run: chmod +x gradlew
- name: Get version number
id: versionNumber
run: echo "::set-output name=versionNumber::$(./gradlew printVersion --quiet | tail -1)"
- name: Login to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_API }}
2023-02-06 00:35:49 +01:00
- 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
2023-01-31 20:50:24 +01:00
- name: Setup buildx
2023-02-06 00:35:49 +01:00
if: steps.checkIdExists.outcome != 'failure'
2023-01-31 20:50:24 +01:00
run: |
docker buildx create --name mybuilder
docker buildx use mybuilder
2023-02-06 00:35:49 +01:00
- name: Build and push versioned amd64 and v8
if: github.ref == 'refs/heads/main' && steps.checkIdExists.outcome != 'failure'
2023-01-31 20:50:24 +01:00
run: |
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}" .
2023-01-31 20:50:24 +01:00
- name: Build and push latest amd64 and v8
2023-02-06 12:01:23 +01:00
if: github.ref == 'refs/heads/master'
2023-01-31 20:50:24 +01:00
run: |
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:latest" .