Skip to content

Fix startup #dockerpush #85

Fix startup #dockerpush

Fix startup #dockerpush #85

Workflow file for this run

name: Push to DockerHub
on: [ push ]
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
jobs:
push-to-docker-hub:
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, '#dockerpush') }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
cache: gradle
- name: docker login
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d--%M-%S')"
- name: Code build
run: ./gradlew build --no-daemon -x test -x check
- name: Docker build
run: docker build . --file Dockerfile --tag $DOCKER_USER/${{ github.event.repository.name }}:${{ steps.date.outputs.date }}
- name: Tag with latest
if: ${{ contains(github.event.head_commit.message, '#latest') }}
run: docker tag $DOCKER_USER/${{ github.event.repository.name }}:${{ steps.date.outputs.date }} $DOCKER_USER/${{ github.event.repository.name }}:latest
- name: Docker push
run: docker push --all-tags $DOCKER_USER/${{ github.event.repository.name }}
- name: Call Portainer
uses: fjogeleit/http-request-action@v1
if: ${{ contains(github.event.head_commit.message, '#latest') }}
with:
url: ${{ secrets.WEBHOOK_URL }}
method: 'POST'
timeout: 30000