Skip to content

Commit

Permalink
bug: fix GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbrig committed Sep 11, 2024
1 parent e831402 commit cb752bd
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/docker-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ on:
- 'DESCRIPTION'
- 'NAMESPACE'
workflow_dispatch:

env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_REGION: ${{ secrets.GCP_REGION }}
GCP_SERVICE_ACCOUNT_CREDENTIALS: ${{ secrets.GCP_SERVICE_ACCOUNT_CREDENTIALS }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
GCP_GAR_NAME: "demo-rshiny-cloudrun"
APP_NAME: "rshinycloudrun"
REPOSITORY_NAME: ${{ github.repository }}
APP_NAME: rshinycloudrun

Expand All @@ -32,14 +34,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Google Auth
id: auth
uses: google-github-actions/auth@v2
with:
token_format: 'access_token'
credentials_json: ${{ env.GCP_SA_KEY }}

- name: Set up Cloud SDK
id: setup-cloud-sdk
uses: google-github-actions/setup-gcloud@v2
Expand All @@ -48,7 +50,7 @@ jobs:

- name: Verify gcloud CLI
run: gcloud info

- name: Docker Auth
id: docker-auth
run: |-
Expand All @@ -60,28 +62,23 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get Image Tag
id: get-image-tag
run: |-
echo ::set-env name=IMAGE_TAG::${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.REPOSITORY_NAME }}/${{ env.APP_NAME }}:${{ github.sha }}
- name: Build and Push Container
id: build
run: |-
docker build -t ${{ env.IMAGE_TAG }} .
docker build --build-arg R_CONFIG_ACTIVE=production . --tag $GCP_REGION-docker.pkg.dev/$GCP_PROJECT_ID/$GCP_GAR_NAME/$APP_NAME:$GITHUB_SHA
docker push ${{ env.IMAGE_TAG }}
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ env.APP_NAME }}
image: ${{ env.IMAGE_TAG }}
image: $GCP_REGION-docker.pkg.dev/$GCP_PROJECT_ID/$GCP_GAR_NAME/$APP_NAME:$GITHUB_SHA
region: ${{ env.GCP_REGION }}
platform: managed
allow-unauthenticated: true
env_vars: |
R_CONFIG_ACTIVE=production
- name: Output Service URL
run: echo ${{ steps.deploy.outputs.url }}

0 comments on commit cb752bd

Please sign in to comment.