-
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.
Merge pull request #4 from pvcy/jc/test-migration-action
Update Google GitHub Action
- Loading branch information
Showing
2 changed files
with
37 additions
and
5 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,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 |
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 |
---|---|---|
|
@@ -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 | ||
|