From ba4620f6c76dcaf584a212c186b2eb4e82da4506 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Wed, 18 Sep 2024 16:00:45 +0100 Subject: [PATCH] =?UTF-8?q?Add=20the=20missing=20action=20=F0=9F=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle-deploy-develop.yml | 112 ++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/gradle-deploy-develop.yml diff --git a/.github/workflows/gradle-deploy-develop.yml b/.github/workflows/gradle-deploy-develop.yml new file mode 100644 index 000000000..8fe4fb888 --- /dev/null +++ b/.github/workflows/gradle-deploy-develop.yml @@ -0,0 +1,112 @@ +name: Gradle Build & Deploy - Develop +on: + push: + branches: + - 'develop' + - 'feature-2532/graal' +env: + PROJECT_ID: ${{ secrets.RUN_PROJECT }} + RUN_REGION: us-central1 + SERVICE_NAME: checkins-develop +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Node LTS + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Set up Temurin 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Run tests with Gradle + run: ./gradlew check + deploy: + permissions: + contents: 'read' + id-token: 'write' + runs-on: ubuntu-latest + environment: + name: Development + url: https://checkins-develop-tuvcfzotpq-uc.a.run.app/ + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Node LTS + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Set up Temurin 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - id: 'auth' + uses: 'google-github-actions/auth@v2' + with: + project_id: 'oci-intern-2019' + workload_identity_provider: 'projects/832140020593/locations/global/workloadIdentityPools/github/providers/my-repo' + - name: 'Set up Cloud SDK' + uses: google-github-actions/setup-gcloud@v2 + with: + version: '>= 363.0.0' + - name: 'Auth Configure Docker' + run: |- + gcloud --quiet auth configure-docker + - name: Build the Docker image + run: |- + cd server + docker build --tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" . + - name: Push the Docker image to Google Container Registry + run: docker push "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" + - name: Deploy image to Cloud Run + run: |- + gcloud run deploy "$SERVICE_NAME" \ + --quiet \ + --region "$RUN_REGION" \ + --image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \ + --memory 1Gi \ + --add-cloudsql-instances ${{ secrets.DB_CONNECTION_NAME }} \ + --set-env-vars "CLOUD_DB_CONNECTION_NAME=${{ secrets.DB_CONNECTION_NAME }}" \ + --set-env-vars "DB_NAME=${{ secrets.DB_NAME }}" \ + --set-env-vars "DATASOURCES_DEFAULT_PASSWORD=${{ secrets.DB_PASSWORD }}" \ + --set-env-vars "DATASOURCES_DEFAULT_USERNAME=${{ secrets.DB_USERNAME }}" \ + --set-env-vars "AES_KEY=${{ secrets.AES_KEY }}" \ + --set-env-vars "OAUTH_CLIENT_ID=${{ secrets.OAUTH_CLIENT_ID }}" \ + --set-env-vars "OAUTH_CLIENT_SECRET=${{ secrets.OAUTH_CLIENT_SECRET }}" \ + --set-env-vars "OAUTH_CALLBACK_URI"=${{ secrets.OAUTH_CALLBACK_URI }} \ + --set-env-vars "DIRECTORY_ID=${{ secrets.DIRECTORY_ID }}" \ + --set-env-vars "SERVICE_ACCOUNT_CREDENTIALS=${{ secrets.SERVICE_ACCOUNT_CREDENTIALS }}" \ + --set-env-vars "GSUITE_SUPER_ADMIN=${{ secrets.GSUITE_SUPER_ADMIN }}" \ + --set-env-vars "MJ_APIKEY_PUBLIC=${{ secrets.MJ_APIKEY_PUBLIC }}" \ + --set-env-vars "MJ_APIKEY_PRIVATE=${{ secrets.MJ_APIKEY_PRIVATE }}" \ + --set-env-vars "GIT_HUB_TOKEN=${{ secrets.GIT_HUB_TOKEN }}" \ + --set-env-vars "WEB_ADDRESS=https://checkins-develop-tuvcfzotpq-uc.a.run.app" \ + --set-env-vars "FROM_ADDRESS=kimberlinm@objectcomputing.com" \ + --set-env-vars "FROM_NAME=Check-Ins - DEVELOP" \ + --set-env-vars "^@^MICRONAUT_ENVIRONMENTS=dev,cloud,google,gcp" \ + --platform "managed" \ + --max-instances 2 \ + --allow-unauthenticated