Skip to content

Update dependency org.springframework.boot to v3.3.5 (#58) #391

Update dependency org.springframework.boot to v3.3.5 (#58)

Update dependency org.springframework.boot to v3.3.5 (#58) #391

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
push:
branches:
- main
paths-ignore:
- '**/*.md'
env:
TERM: dumb
jobs:
assemble-and-check:
name: Build executable jar, run unit tests and static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '23'
- uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- run: ./gradlew assemble check
deploy:
name: Build and push container image to Google Artifact Registry, deploy to Cloud Run
needs: [ assemble-and-check ]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm-community'
java-version: '23'
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: gradle/actions/setup-gradle@v4
- name: Build GraalVM native executable
run: ./gradlew nativeCompile
- uses: docker/login-action@v3
with:
registry: ${{ secrets.GCP_REGION }}-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCP_CREDENTIALS_JSON }}
- name: Add environment variable for short SHA
run: echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Build and push container image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ vars.CONTAINER_IMAGE }}:${{ env.SHA_SHORT }},${{ vars.CONTAINER_IMAGE }}:latest
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
- uses: google-github-actions/setup-gcloud@v2
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{ vars.SERVICE_NAME }} \
--image ${{ vars.CONTAINER_IMAGE }}:${{ env.SHA_SHORT }} \
--update-secrets=KS_REDIS_REST_URL=redis-rest-url:latest,KS_REDIS_REST_TOKEN=redis-rest-token:latest \
--region ${{ secrets.GCP_REGION }} \
--cpu ${{ vars.CONTAINER_CPU }} \
--memory ${{ vars.CONTAINER_MEMORY }} \
--timeout ${{ vars.CONTAINER_REQUEST_TIMEOUT }} \
--min-instances ${{ vars.CONTAINER_MIN_INSTANCES }} \
--max-instances ${{ vars.CONTAINER_MAX_INSTANCES }} \
--platform managed \
--allow-unauthenticated
- name: Cleanup old images
run: |
# Get all images except the most recent 2
IMAGES_TO_DELETE=$(gcloud artifacts docker images list ${{ vars.CONTAINER_IMAGE }} \
--format="get(DIGEST)" \
--sort-by="~CREATE_TIME" | tail -n +3)
# Delete the older images
for DIGEST in $IMAGES_TO_DELETE; do
gcloud artifacts docker images delete ${{ vars.CONTAINER_IMAGE }}@$DIGEST \
--delete-tags \
--quiet
done