Stirling-PDF/.github/workflows/push-docker.yml
2023-01-29 18:41:33 +00:00

75 lines
1.6 KiB
YAML

name: Push Docker Image with VersionNumber
on:
push:
branches:
- master
- main
jobs:
detectChangeType:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Has Changed
uses: YassinEldeeb/has-changed-path@v2.1
id: changed
with:
# Paths to detect changes
paths: build.gradle src/ Dockerfile
push:
runs-on: ubuntu-latest
if: steps.changed.outputs.changed == 'true'
steps:
- 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 }}
- name: Build and push
uses: docker/build-push-action@v3
if: github.ref == 'refs/heads/main'
with:
context: .
push: true
tags: |
frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}
- name: Build and push
uses: docker/build-push-action@v3
if: github.ref == 'refs/heads/master'
with:
context: .
push: true
tags: |
frooodle/s-pdf:latest