-
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
Showing
4 changed files
with
83 additions
and
19 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,59 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create credentials.json | ||
run: echo '${{ secrets.GCS_SERVICE_ACCOUNT_OLD }}' > $GITHUB_WORKSPACE/credentials.json | ||
|
||
- name: Authenticate to Google Cloud | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
|
||
- name: "Set up Cloud SDK" | ||
uses: "google-github-actions/setup-gcloud@v1" | ||
with: | ||
project_id: "healthy-highway-293513" | ||
service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
version: "latest" | ||
|
||
- name: "Use gcloud CLI" | ||
run: "gcloud info" | ||
|
||
- name: "Download .env from GCS" | ||
run: | | ||
gsutil cp gs://action-envs/luzia-api.env ./.env | ||
- name: "Docker auth" | ||
run: |- | ||
gcloud auth configure-docker us-central1-docker.pkg.dev --quiet | ||
- name: Build image | ||
run: docker build . --file ./infra/Dockerfile --tag us-central1-docker.pkg.dev/healthy-highway-293513/eagle-spirit/eagle:luzia-api-${{ github.sha }} | ||
|
||
- name: Push image | ||
run: docker push us-central1-docker.pkg.dev/healthy-highway-293513/eagle-spirit/eagle:luzia-api-${{ github.sha }} | ||
|
||
- name: Update GitOps Repo | ||
run: | | ||
# Clone your GitOps repo # | ||
git clone https://${{ secrets.PAT }}@github.com/eagle-spirit/deployment.git | ||
# Change to the directory containing your manifests | ||
cd deployment/luzia-api | ||
# Replace the image tag in your manifests | ||
sed -i "s/luzia-api-[0-9a-f]\{40\}/luzia-api-${{ github.sha }}/g" deployment.yaml | ||
# Commit and push the changes to GitHub | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Gabriel Aranha" | ||
git commit -am "Update image tag to luzia-api-${{ github.sha }}" | ||
git push |
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 |
---|---|---|
|
@@ -182,3 +182,4 @@ results/* | |
models/* | ||
custom_metrics.py | ||
app/credentials/*.json | ||
credentials.json |
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
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