-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
1 changed file
with
46 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,46 @@ | ||
name: Deploy backend to GCP | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
server-id: github | ||
|
||
- name: Build with Maven | ||
run: mvn -B -f backend/pom.xml package | ||
|
||
- name: 'Set up Cloud SDK' | ||
uses: 'google-github-actions/setup-gcloud@v1' | ||
|
||
- name: Build with Maven | ||
run: mvn -B -f backend/pom.xml package | ||
|
||
- name: Configure Docker | ||
run: gcloud auth configure-docker | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build --build-args GOOGLE_FILE_PASSWORD=$GOOGLE_FILE_PASSWORD -t gcr.io/brief-me-backend/brief-me-backend:1.0 -f docker/Dockerfile . | ||
docker push gcr.io/brief-me-backend/brief-me-backend:1.0 | ||
- name: Deploy to GCP | ||
run: | | ||
gcloud run deploy brief-me-backend-app --image gcr.io/brief-me-backend/brief-me-backend:1.0 --platform managed | ||
env: | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_SA_KEY }} |