-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to build and push image to GCP Artifact Registry
- Loading branch information
Ole Furseth
committed
Jan 18, 2024
1 parent
ae7a482
commit 1dce299
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: Build and push image to GCP | ||
|
||
on: push #TODO change to on: push main after testing | ||
|
||
jobs: | ||
docker_build_push_gcp: | ||
name: 'Docker build and push to GCP' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
steps: | ||
- uses: 'actions/checkout@v4' | ||
|
||
- name: Authenticate to Google Cloud | ||
id: auth | ||
uses: 'google-github-actions/auth@v2' | ||
with: | ||
credentials_json: ${{ secrets.GCS_ACC_KEY_JSON }} | ||
|
||
# To optionally display info about current gcloud environment | ||
- name: 'Set up Cloud SDK' | ||
uses: "google-github-actions/setup-gcloud@v1" | ||
|
||
- name: "Use gcloud CLI" | ||
run: "gcloud info" | ||
|
||
# Auth Docker to access the artifact registry | ||
- name: "Docker auth" | ||
run: |- | ||
gcloud auth configure-docker europe-north1-docker.pkg.dev --quiet | ||
- name: Login to GAR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: europe-north1-docker.pkg.dev | ||
username: _json_key | ||
password: ${{ secrets.GCS_ACC_KEY_JSON }} | ||
|
||
- name: Push to Google Artifact Registry | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: | | ||
europe-north1-docker.pkg.dev/spire-ros-5lmr/kv-ros/backstage:latest | ||