Merge pull request #66 from Mellanox/dependabot/go_modules/github.com… #18
Workflow file for this run
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
name: "Image push release" | |
on: | |
push: | |
tags: | |
- v* | |
env: | |
REGISTRY: "ghcr.io" | |
OPERATOR_IMAGE_NAME: "nic-configuration-operator" | |
DAEMON_IMAGE_NAME: "nic-configuration-operator-daemon" | |
jobs: | |
image-build-push: | |
name: Image build and push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set repository owner as lower-case output variable | |
id: repo_owner | |
run: echo REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker operator image meta | |
id: docker_meta_operator | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }} | |
tags: | | |
type=ref,event=tag | |
flavor: | | |
latest=false | |
- name: Build and push operator image | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ steps.docker_meta_operator.outputs.tags }} | |
labels: ${{ steps.docker_meta_operator.outputs.labels }} | |
- name: Docker daemon image meta | |
id: docker_meta_daemon | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.DAEMON_IMAGE_NAME }} | |
tags: | | |
type=ref,event=tag | |
flavor: | | |
latest=false | |
- name: Build and push config daemon image | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ steps.docker_meta_daemon.outputs.tags }} | |
labels: ${{ steps.docker_meta_daemon.outputs.labels }} | |
file: ./Dockerfile.nic-configuration-daemon | |
- name: Determine version, tag, and base branch | |
run: | | |
git_tag=${{ github.ref_name }} | |
echo VERSION_WITH_PREFIX=$git_tag >> $GITHUB_ENV | |
echo VERSION_WITHOUT_PREFIX=${git_tag:1} >> $GITHUB_ENV # without the 'v' prefix | |
if echo $git_tag | grep beta; then | |
base_branch=$DEFAULT_BRANCH | |
else | |
v_major_minor=$(echo $git_tag | grep -Eo '^v[0-9]+\.[0-9]+') | |
base_branch=$v_major_minor.x | |
fi | |
echo BASE_BRANCH=$base_branch >> $GITHUB_ENV | |
- name: Lookup image digest | |
run: | | |
operator_digest=$(skopeo inspect docker://$REGISTRY/$REPO_OWNER/$OPERATOR_IMAGE_NAME:$VERSION_WITH_PREFIX | jq -r .Digest) | |
echo $operator_digest | wc -w | grep 1 # verifies value not empty | |
echo OPERATOR_DIGEST=$operator_digest >> $GITHUB_ENV | |
daemon_digest=$(skopeo inspect docker://$REGISTRY/$REPO_OWNER/$DAEMON_IMAGE_NAME:$VERSION_WITH_PREFIX | jq -r .Digest) | |
echo $daemon_digest | wc -w | grep 1 # verifies value not empty | |
echo DAEMON_DIGEST=$daemon_digest >> $GITHUB_ENV | |
- name: Make bundle | |
env: | |
OPERATOR_IMAGE_TAG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}@${{ env.OPERATOR_DIGEST }} | |
CONFIG_DAEMON_IMAGE_TAG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.DAEMON_IMAGE_NAME }}@${{ env.DAEMON_DIGEST }} | |
BUNDLE_IMG: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.OPERATOR_IMAGE_NAME }}-bundle:${{ github.ref_name }} | |
VERSION: ${{ env.VERSION_WITHOUT_PREFIX }} | |
run: | | |
version_major_minor=$(echo $VERSION_WITH_PREFIX | grep -Eo 'v[0-9]+\.[0-9]+') | |
export CHANNELS=stable,$version_major_minor | |
export DEFAULT_CHANNEL=$version_major_minor | |
make bundle bundle-build bundle-push |