monobudget import: WIP #90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |