Skip to content

Commit

Permalink
Update Google GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
john-craft committed Oct 24, 2023
1 parent 9f61b56 commit d054a03
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and Push Container Image
on:
pull_request:
branches: [ main ]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Google Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: database-migration-anonymized
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true

- name: Build and Push
run: |
docker build -t users-db --file db/Dockerfile .
gcloud auth configure-docker
docker tag users-db:latest gcr.io/database-migration-anonymized/users-db
docker push gcr.io/database-migration-anonymized/users-db
18 changes: 13 additions & 5 deletions .github/workflows/test-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Authenticate with GCP
uses: google-github-actions/[email protected]
uses: google-github-actions/auth@v1
with:
project_id: $GCP_PROEJCT_ID
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Use gcloud CLI
run: gcloud info

- name: Configure Docker to authenticate with GCR
run: |
gcloud auth configure-docker
- name: Pull PostgreSQL image from GCP
run: |
docker pull gcr.io/$GCP_PROEJCT_ID/$DB_HOST:latest
Expand Down

0 comments on commit d054a03

Please sign in to comment.