|
|
@@ -0,0 +1,44 @@
|
|
|
+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: '25'
|
|
|
+ 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 JDK
|
|
|
+ uses: actions/setup-java@v3
|
|
|
+ with:
|
|
|
+ java-version: '25'
|
|
|
+ distribution: 'temurin'
|
|
|
+ - name: Build
|
|
|
+ run: ./gradlew build
|
|
|
+ - name: Set up Docker Buildx
|
|
|
+ uses: docker/setup-buildx-action@v2
|
|
|
+ - name: Login to Docker Hub
|
|
|
+ uses: docker/login-action@v2
|
|
|
+ with:
|
|
|
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
+ - name: Build and Push Image
|
|
|
+ run: |
|
|
|
+ docker buildx create --use
|
|
|
+ docker buildx build --platform linux/amd64,linux/arm64 -t dbohry/knotes:latest --push .
|