Skip to content

Image Release

Image Release #17

name: Image Release
on:
workflow_dispatch:
inputs:
ref:
description: "The Operator branch/tag to checkout when creating the image."
required: true
default: "main"
tag:
type: string
default: latest
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
release-version: ${{ github.event.inputs.tag }}
#replace_version: ${{ github.event.inputs.prev_version }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Configure Git
run: |
git config --global user.name "pminz"
git config --global user.email "pminz@redhat.com"
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
token: ${{ env.GITHUB_TOKEN }}
path: operator
- name: Tag the release
run: |
cd operator
git tag -a ${{ env.release-version}} -m "Release Operator:: ${{ env.release-version}}"
git push origin ${{ env.release-version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v9.2.0
cache-image: false
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.PRIVATE_QUAY_USERNAME }}
password: ${{ secrets.PRIVATE_QUAY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: operator
platforms: linux/amd64,linux/arm64
push: true
tags: quay.io/pminz/infinispan-operator:${{ env.release-version}}.Final
build-args: |
OPERATOR_VERSION=${{ env.release-version}}
- name: Create OLM Bundle
run: |
rm -rf bundle bundle.Dockerfile
cd operator
make bundle VERSION=${{ env.release-version}} CHANNELS=stable DEFAULT_CHANNEL=stable IMG=quay.io/pminz/infinispan-operator:${{ env.release-version}}.Final
- name: Checkout community-operators repo
uses: actions/checkout@v3
with:
repository: pminz/community-operators
path: community-operators
ref: main
- name: Copy contents of bundle/
run: |
cd community-operators
mkdir -p operators/infinispan/${{ env.release-version }}
ls -lrth
pwd
cp -R ../operator/bundle/* operators/infinispan/${{ env.release-version }}
git add operators/infinispan/${{ env.release-version }}
git commit -s -m "Infinispan ${{ env.release-version }}"
#- name: Create Pull Request to community-operators repo from forked repository
# id: cpr
# uses: peter-evans/create-pull-request@v4
# with:
# token: ${{ secrets.PAT_TOKEN }}
# path: community-operators
# commit-message: 'Infinispan Operator ${{ env.release-version }}'
# committer: infinispan-qe-bot <q*@infinispan.org>
# author: infinispan-qe-bot <q*@infinispan.org>
# branch: pr_request
# delete-branch: true
# push-to-fork: infinispan-qe-bot/community-operators
# title: 'Infinispan Operator ${{ env.release-version }}'
# body: 'Infinispan Operator ${{ env.release-version }}'
- name: Checkout community-operators-prod repo
uses: actions/checkout@v3
with:
repository: pminz/community-operators-prod
path: community-operators-prod
ref: main
- name: Copy contents of bundle/ and issue PRs
run: |
cd community-operators-prod
mkdir -p operators/infinispan/${{ env.release-version }}
pwd
ls -lrth
tree
cp -R ../operator/bundle/* operators/infinispan/${{ env.release-version }}
git add operators/infinispan/${{ env.release-version }}
git commit -s -m "Infinispan ${{ env.release-version }}"
#- name: Create Pull Request
# id: cpr1
# uses: peter-evans/create-pull-request@v4
# with:
# token: ${{ secrets.PAT_TOKEN }}
# path: community-operators-prod
# commit-message: 'Infinispan Operator ${{ env.release-version }}'
# committer: infinispan-qe-bot <q*@infinispan.org>
# author: infinispan-qe-bot <q*@infinispan.org>
# branch: pr_request
# delete-branch: true
# push-to-fork: infinispan-qe-bot/community-operators-prod
# title: 'Infinispan Operator ${{ env.release-version }}'
# body: 'Infinispan Operator ${{ env.release-version }}'
#- name: Trigger Post Release job
# uses: cardinalby/schedule-job-action@v1
# with:
# ghToken: ${{ secrets.PAT_TOKEN }}
# targetBranch: 'main'
# templateYmlFile: './operator/.github-scheduled-workflows/publish-main.yaml'
# targetYmlFileName: publish-main.yaml
# copyEnvVariables: release-version replace_version