-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from BurtonTechnical/main
Pulling in deploy action
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Deploy to Google Cloud Run | ||
on: | ||
release | ||
jobs: | ||
build: | ||
name: Build image | ||
runs-on: ubuntu-latest | ||
env: | ||
HASH: $(git rev-parse --short "$GITHUB_SHA") | ||
BRANCH: ${GITHUB_REF##*/} | ||
SERVICE_NAME: ${{ secrets.SERVICE_NAME }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# Setup gcloud CLI | ||
- uses: google-github-actions/github-actions/setup-gcloud@master | ||
with: | ||
service_account_key: ${{ secrets.GCR_DEVOPS_SERVICE_ACCOUNT_KEY }} | ||
project_id: ${{ secrets.PROJECT_ID }} | ||
export_default_credentials: true | ||
|
||
# Build docker image | ||
- name: Build Docker Image | ||
run: |- | ||
docker build --build-arg -t northamerica-northeast1-docker.pkg.dev/ranlab-mvp-295423/ranlab-api-mvp/ranlab-api-mvp:latest . | ||
# Configure docker to use the gcloud command-line tool as a credential helper | ||
- run: | | ||
gcloud auth configure-docker -q | ||
# Push image to Google Container Registry | ||
- name: Push Image to GCR | ||
run: |- | ||
docker push northamerica-northeast1-docker.pkg.dev/ranlab-mvp-295423/ranlab-api-mvp/ranlab-api-mvp:latest | ||
- name: Deploy Container | ||
run: |- | ||
gcloud run | ||
deploy ranlab-api-mvp \ | ||
--quiet | ||
--platform=managed \ | ||
--region=northamerica-northeast1 \ | ||
--allow-unauthenticated \ | ||
--image northamerica-northeast1-docker.pkg.dev/ranlab-mvp-295423/ranlab-api-mvp/ranlab-api-mvp:latest |