Skip to content

Commit

Permalink
✨ push operator images to gcr
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Jun 25, 2024
1 parent f4e6f9e commit 137a1f5
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,23 @@ on:
branches: [main]
# Publish semver tags as releases.
tags: ["v*.*.*"]
workflow_dispatch:
inputs:
version:
description: 'Version of the cnspec container to publish'
type: string
required: false
default: 'latest'

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
RELEASE: ${{ github.ref_name }}

GHCR_IMAGE: ghcr.io/${{ github.repository }}
GCP_IMAGE: us-docker.pkg.dev/mondoohq/release/${{ github.repository }}
RELEASE: ${{ inputs.version }}

jobs:
debug-event:
Expand Down Expand Up @@ -174,6 +184,44 @@ jobs:
TAGS: ${{ steps.meta.outputs.tags }}
CPU_ARCHS: amd64 arm64 arm

push-gcp:
name: Push to GCP
runs-on: ubuntu-latest
needs:
- push-virtual-tag

permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Install Skopeo
run: |
sudo apt-get update
sudo apt-get -y install skopeo
- name: Push to GCP
run: |
tags = ${{ steps.meta.outputs.tags }}
for tag in $tags; do
gcpRepo = "${$tag/$GHCR_IMAGE/"${{ env.GCP_IMAGE }}"}"
skopeo copy --all $tag ${{ env.GCP_IMAGE }}:$tag
done
build-bundle:
if: startsWith(github.ref, 'refs/tags/v')
needs:
Expand Down

0 comments on commit 137a1f5

Please sign in to comment.