| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- name: Release
- on:
- push:
- branches: [ main ]
- jobs:
- build-and-test:
- name: Build and Test
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Set up JDK
- uses: actions/setup-java@v3
- with:
- java-version: '21'
- distribution: 'temurin'
- - name: Build with Gradle
- run: chmod +x ./gradlew && ./gradlew clean build test
- dockerize:
- name: Dockerize Application
- needs: build-and-test
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
- - name: Cache Docker layers
- uses: actions/cache@v2
- with:
- path: /tmp/.buildx-cache
- key: ${{ runner.os }}-buildx-${{ github.sha }}
- restore-keys: ${{ runner.os }}-buildx-
- - name: Set up JDK
- uses: actions/setup-java@v3
- with:
- java-version: '21'
- distribution: 'temurin'
- - name: Build the Docker image
- run: ./gradlew build && docker build -t dbohry/auth-service .
- - name: Login to Docker Hub
- uses: docker/login-action@v2
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Push image
- run: docker push dbohry/auth-service
|