Skip to content

Commit

Permalink
feat(github actions): adding github action to run release script and …
Browse files Browse the repository at this point in the history
…push images to demo GAR repository
  • Loading branch information
dlactin committed Nov 20, 2024
1 parent f528fdd commit 6979408
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build-and-push-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Rollouts Demo -- Build and Push Container Images to GAR

on:
push:
branches:
- main

env:
IMAGE_NAME: rollouts-demo
GAR_LOCATION: us
GCP_PROJECT_ID: moz-fx-cicd-demos-nonprod
IMAGE_NAMESPACE: us-docker.pkg.dev/moz-fx-cicd-demos-nonprod/cicd-demos-nonprod

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run the release script to build demo container images
run: release.sh

build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- id: gcp-auth
name: Google authentication
uses: google-github-actions/auth@v2
with:
token_format: "access_token"
service_account: artifact-writer@${{ env.GCP_PROJECT_ID }}.iam.gserviceaccount.com
workload_identity_provider: ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.gcp-auth.outputs.access_token }}
- name: Push images to GAR
uses: docker/build-push-action@v3
with:
context: .
tags: |
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:red
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:orange
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:blue
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:purple
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:slow-orange
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:slow-red
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:bad-orange
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:bad-red
push: true
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 6979408

Please sign in to comment.