Skip to content

Commit

Permalink
Add workflow to build and push image to GCP Artifact Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Furseth committed Jan 18, 2024
1 parent ae7a482 commit 1dce299
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build-and-push.yml
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

0 comments on commit 1dce299

Please sign in to comment.