Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeffscottbrown/0cc4b9f03b85a8a0c84d7513078ee0cd to your computer and use it in GitHub Desktop.
Save jeffscottbrown/0cc4b9f03b85a8a0c84d7513078ee0cd to your computer and use it in GitHub Desktop.
name: Publish To GCR
on:
push:
tags:
- 'v*'
env:
GCLOUD_REGION: ${{ secrets.GCLOUD_REGION }}
PROJECT_ORGANIZATION: ${{ secrets.PROJECT_ORGANIZATION }}
DOCKER_IMAGE: ${{ secrets.DOCKER_REGISTRY_URL }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
key: ${{ runner.os }}-gradle-test-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-test-
- name: Setup GraalVM CE
uses: DeLaGuardo/[email protected]
with:
graalvm-version: 21.1.0.java11
- name: Install Native Image
run: gu install native-image
- name: Setup Google Cloud CLI
uses: google-github-actions/setup-gcloud@master
with:
version: '290.0.1'
service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
- name: Docker Login
run: |
gcloud auth configure-docker
- name: Build And Push Docker Image
env:
TESTCONTAINERS_RYUK_DISABLED: true
run: |
./gradlew check clean --no-daemon
./gradlew check assemble --no-daemon
./gradlew check dockerPushNative --no-daemon
- name: Deploy Cloud Run
run: |
gcloud run deploy music-search --quiet \
--image "${DOCKER_IMAGE}" --project "${PROJECT_ORGANIZATION}" \
--region "${GCLOUD_REGION}" --platform managed --allow-unauthenticated --format json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment