Update base image to eclipse-temurin:17 #33
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 deploy JAR to GCP | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| - '.github/workflows/**' | |
| workflow_dispatch: | |
| env: | |
| IMAGE_URL: europe-north1-docker.pkg.dev/saltjokes-385809/saltjokes-repo/jokes:${{ github.sha }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - id: 'auth' | |
| name: Authenticate GCP | |
| uses: google-github-actions/auth@v1 | |
| with: | |
| credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v1 | |
| - name: Use gcloud CLI | |
| run: gcloud info | |
| - name: Configure docker | |
| run: gcloud auth configure-docker europe-north1-docker.pkg.dev | |
| - name: Set up Java version | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: '17' | |
| - name: Run tests | |
| run: ./gradlew test | |
| - name: Build jar | |
| if: success() | |
| run: ./gradlew bootJar | |
| - name: Docker Build | |
| run: docker build -t $IMAGE_URL . | |
| - name: Docker Push | |
| run: docker push $IMAGE_URL | |
| - name: Update Cloud Run service | |
| uses: google-github-actions/deploy-cloudrun@v1 | |
| with: | |
| service: jokes | |
| image: ${{ env.IMAGE_URL }} |