update SpringBoot Version #32
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
| on: [push] | |
| env: | |
| DEPLOYMENT_NAME: ${{ secrets.TEAMNAME }} | |
| DEPLOYMENT_PORT: ${{ secrets.PORT }} | |
| DEPLOYMENT_TOKEN: ${{ secrets.TOKEN }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Build app | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@master | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache maven packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Build jar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
| run: | | |
| mvn --batch-mode --update-snapshots clean spring-boot:build-image k8s:resource -Dspring-boot.build-image.imageName=ghcr.io/${{ github.repository_owner }}/${{ env.DEPLOYMENT_NAME }}:latest -Ddeployment.name=${{ env.DEPLOYMENT_NAME }} -Ddeployment.port=${{ env.DEPLOYMENT_PORT }} | |
| - name: Log in to registry | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Push the Docker image to GHCR | |
| run: | | |
| docker push ghcr.io/${{ github.repository_owner }}/${{ env.DEPLOYMENT_NAME }} | |
| - name: Deploy | |
| run: |- | |
| echo "${{ env.DEPLOYMENT_TOKEN }}" > kubeconfig.yaml | |
| kubectl --kubeconfig kubeconfig.yaml apply -f target/classes/META-INF/jkube/kubernetes.yml | |
| kubectl --kubeconfig kubeconfig.yaml --namespace techdays rollout status deployment/${{ env.DEPLOYMENT_NAME }} | |
| kubectl --kubeconfig kubeconfig.yaml --namespace techdays get services -o wide | |
| rm kubeconfig.yaml |