Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Google GitHub Action #4

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading