-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8464bf3
commit 148a1b6
Showing
6 changed files
with
529 additions
and
48 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 |
---|---|---|
@@ -1,21 +1,51 @@ | ||
name: Deploy to Google Cloud Run | ||
name: Deploy to Google Cloud | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
- develop | ||
workflow_dispatch: | ||
|
||
env: | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
REGION: ${{ secrets.REGION }} | ||
REPOSITORY_NAME: "keycloak-repo" # Must be local.registry_name | ||
IMAGE_NAME: "keycloak-image" # @todo is it right? | ||
IMAGE_TAG: "latest" # default?? | ||
|
||
jobs: | ||
terraform: | ||
name: Apply Terraform Configuration | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
deploy: | ||
name: Deploy to Google Cloud Run | ||
needs: terraform | ||
runs-on: ubuntu-latest | ||
- name: Set up Google Cloud credentials | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} | ||
|
||
steps: | ||
- name: Configure Docker | ||
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev | ||
|
||
- name: Build Docker image | ||
run: | | ||
# "europe-west6-docker.pkg.dev/keycloak-dev-399613/keycloak/keycloak@sha256:0eeed2228ff032040510f2b478f1bb475693179018cfd5587d9a0cc1d7c5716e" | ||
docker build -t ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} . | ||
|
||
- name: Push Docker image to Google Artifact Registry | ||
run: | | ||
docker push ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | ||
- name: Set up Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_wrapper: false | ||
|
||
- name: Terraform Init | ||
run: terraform init | ||
|
||
- name: Terraform Apply | ||
run: | | ||
terraform apply -auto-approve -var="project_id=${{ env.PROJECT_ID }}" -var="region=${{ env.REGION }}" -var="image=${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
dev |
Oops, something went wrong.