Skip to content

Build and Release

Build and Release #450

Workflow file for this run

name: Build and Release
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
branch:
description: 'Branch to target for release'
required: true
tag:
description: 'Tag to attach to image'
required: true
channel:
description: 'Operatorhub channel, see https://github.com/redhat-openshift-ecosystem/community-operators-prod/blob/main/operators/project-quay/project-quay.package.yaml'
required: true
clair-version:
description: 'Clair version'
required: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
quay:
name: "Build and Push Quay Image"
runs-on: ubuntu-latest
steps:
- uses: convictional/[email protected]
with:
owner: 'quay'
repo: 'quay'
github_token: ${{ secrets.PAT }}
workflow_file_name: build-and-publish.yaml
ref: ${{ github.event.inputs.branch }}
wait_interval: 30
client_payload: |
{
"tag": "${{ github.event.inputs.tag }}"
}
quay-builder:
name: "Build and Push Quay Builder Image"
runs-on: ubuntu-latest
steps:
- uses: convictional/[email protected]
with:
owner: 'quay'
repo: 'quay-builder'
github_token: ${{ secrets.PAT }}
workflow_file_name: build-and-publish.yaml
ref: ${{ github.event.inputs.branch }}
wait_interval: 30
client_payload: |
{
"tag": "${{ github.event.inputs.tag }}"
}
quay-builder-qemu:
name: "Build and Push Quay Builder QEMU Image"
runs-on: ubuntu-latest
steps:
- run: |
echo "Using quay-builder-qemu:main as image"
# - uses: convictional/[email protected]
# with:
# owner: 'quay'
# repo: 'quay-builder-qemu'
# github_token: ${{ secrets.PAT }}
# workflow_file_name: build-and-publish.yaml
# ref: ${{ github.event.inputs.branch }}
# wait_interval: 30
# client_payload: |
# {
# "tag": "${{ github.event.inputs.tag }}"
# }
quay-operator:
name: "Build and Push Quay Operator Image"
runs-on: ubuntu-latest
steps:
- uses: convictional/[email protected]
with:
owner: 'quay'
repo: 'quay-operator'
github_token: ${{ secrets.PAT }}
workflow_file_name: image.yaml
ref: ${{ github.event.inputs.branch }}
wait_interval: 30
client_payload: |
{
"tag": "${{ github.event.inputs.tag }}"
}
pull-request-redhat-openshift-ecosystem:
name: "Create Pull Request against Red Hat Community Operators Repo"
runs-on: ubuntu-latest
needs: ["quay", "quay-operator", "quay-builder-qemu", "quay-builder"]
steps:
- name: Check out Quay Operator repo
uses: actions/checkout@v3
with:
repository: redhat-openshift-ecosystem/community-operators-prod
token: ${{ secrets.PAT }}
- name: Detect current versions
id: versions
env:
CHANNEL: ${{ github.event.inputs.channel }}
run: |
cd ./operators/project-quay
PREVIOUS_VERSION=$(
for v in *; do
if
[ -e "$v/metadata/annotations.yaml" ] &&
[ "$(yq '.annotations["operators.operatorframework.io.bundle.channels.v1"]' "$v/metadata/annotations.yaml")" = "$CHANNEL" ]
then
echo "$v"
fi
done | sort -rV | head -n1
)
REPLACES=""
if [ -n "$PREVIOUS_VERSION" ]; then
REPLACES="quay-operator.v$PREVIOUS_VERSION"
fi
mkdir -p ./${{ github.event.inputs.tag }}
STABLE_Y_STREAM=$(ls -1d *.0 | sort -rV | head -n1)
DEFAULT_CHANNEL="stable-${STABLE_Y_STREAM%.0}"
echo "replaces=$REPLACES" >> $GITHUB_OUTPUT
echo "default-channel=$DEFAULT_CHANNEL" >> $GITHUB_OUTPUT
- name: Download manifests folder
run: |
git clone --branch ${{ github.event.inputs.branch }} https://${{ secrets.PAT }}@github.com/quay/quay-operator.git
cd ./quay-operator
make prepare-release \
CHANNEL="${{ github.event.inputs.channel }}" \
DEFAULT_CHANNEL="${{ steps.versions.outputs.default-channel }}" \
RELEASE="${{ github.event.inputs.tag }}" \
CLAIR_RELEASE="${{ github.event.inputs.clair-version }}" \
REPLACES="${{ steps.versions.outputs.replaces }}"
rm ./bundle/manifests/quay-operator.service.yaml
cd ..
mv \
./quay-operator/bundle/manifests \
./quay-operator/bundle/metadata \
./operators/project-quay/${{ github.event.inputs.tag }}
rm -rf ./quay-operator
- name: Create Pull Request redhat-openshift-ecosystem
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.PAT }}
commit-message: Add ${{ github.event.inputs.tag }} to community operators
author: quay-devel <[email protected]>
push-to-fork: quay/community-operators-prod
signoff: true
body: Add ${{ github.event.inputs.tag }} to community operators
committer: quay-devel <[email protected]>
pull-request-k8s-operatorhub:
name: "Create Pull Request against Community Operators Repo"
runs-on: ubuntu-latest
needs: ["pull-request-redhat-openshift-ecosystem"]
steps:
- name: Check out Quay k8s-operatorhub/community-operators fork
uses: actions/checkout@v3
with:
repository: k8s-operatorhub/community-operators
token: ${{ secrets.PAT }}
- name: Download community operators repo and pull in prod updates
run: |
git clone --branch create-pull-request/patch https://${{ secrets.PAT }}@github.com/quay/community-operators-prod.git
rm -rf operators/project-quay
mv community-operators-prod/operators/project-quay operators
rm -rf community-operators-prod
- name: Create Pull Request k8s-operatorhub
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.PAT }}
commit-message: Add ${{ github.event.inputs.tag }} to community operators
author: quay-devel <[email protected]>
push-to-fork: quay/community-operators
signoff: true
body: Add ${{ github.event.inputs.tag }} to community operators
committer: quay-devel <[email protected]>