feat: initial commit #1
This file contains hidden or 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: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-push: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 23 | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - name: Get release version | |
| run: | | |
| VERSION=${{ github.event.release.tag_name || 'develop' }} | |
| # Remove the "v" prefix, if it exists | |
| IMAGE_TAG=${VERSION#v} | |
| echo "IMAGE_REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV | |
| echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
| cat $GITHUB_ENV | |
| - name: Build Docker Image with bootBuildImage | |
| run: ./gradlew bootBuildImage --imageName=$IMAGE_REPOSITORY --Pversion=$IMAGE_TAG | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.DOCKER_PAT }} | |
| - name: Push Docker Image | |
| run: docker push $IMAGE_TAG |