mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
87 lines
3.7 KiB
YAML
87 lines
3.7 KiB
YAML
name: Publish AWX Operator on operator-hub
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag_name:
|
|
description: 'Name for the tag of the release.'
|
|
required: true
|
|
operator_hub_fork:
|
|
description: 'Fork of operator-hub where the PR will be created from. default: awx-auto'
|
|
required: true
|
|
default: 'awx-auto'
|
|
image_registry:
|
|
description: 'Image registry where the image is published to. default: quay.io'
|
|
required: true
|
|
default: 'quay.io'
|
|
image_registry_organization:
|
|
description: 'Image registry organization where the image is published to. default: ansible'
|
|
required: true
|
|
default: 'ansible'
|
|
community_operator_github_org:
|
|
description: 'Github organization for community-opeartor project. default: k8s-operatorhub'
|
|
required: true
|
|
default: 'k8s-operatorhub'
|
|
community_operator_prod_github_org:
|
|
description: 'GitHub organization for community-operator-prod project. default: redhat-openshift-ecosystem'
|
|
required: true
|
|
default: 'redhat-openshift-ecosystem'
|
|
jobs:
|
|
promote:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set GITHUB_ENV from workflow_dispatch event
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
run: |
|
|
echo "VERSION=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
|
echo "IMAGE_REGISTRY=${{ github.event.inputs.image_registry }}" >> $GITHUB_ENV
|
|
echo "IMAGE_REGISTRY_ORGANIZATION=${{ github.event.inputs.image_registry_organization }}" >> $GITHUB_ENV
|
|
echo "COMMUNITY_OPERATOR_GITHUB_ORG=${{ github.event.inputs.community_operator_github_org }}" >> $GITHUB_ENV
|
|
echo "COMMUNITY_OPERATOR_PROD_GITHUB_ORG=${{ github.event.inputs.community_operator_prod_github_org }}" >> $GITHUB_ENV
|
|
|
|
- name: Set GITHUB_ENV for release event
|
|
if: ${{ github.event_name == 'release' }}
|
|
run: |
|
|
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
|
|
echo "IMAGE_REGISTRY=quay.io" >> $GITHUB_ENV
|
|
echo "IMAGE_REGISTRY_ORGANIZATION=ansible" >> $GITHUB_ENV
|
|
echo "COMMUNITY_OPERATOR_GITHUB_ORG=k8s-operatorhub" >> $GITHUB_ENV
|
|
echo "COMMUNITY_OPERATOR_PROD_GITHUB_ORG=redhat-openshift-ecosystem" >> $GITHUB_ENV
|
|
|
|
- name: Log in to image registry
|
|
run: |
|
|
echo ${{ secrets.QUAY_TOKEN }} | docker login ${{ env.IMAGE_REGISTRY }} -u ${{ secrets.QUAY_USER }} --password-stdin
|
|
|
|
- name: Checkout awx-operator at workflow branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: awx-operator
|
|
|
|
- name: Checkout awx-opearator at ${{ env.VERSION }}
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-tags: true
|
|
ref: ${{ env.VERSION }}
|
|
path: awx-operator-${{ env.VERSION }}
|
|
fetch-depth: 0 # fetch all history so that git describe works
|
|
|
|
- name: Copy scripts to awx-operator-${{ env.VERSION }}
|
|
run: |
|
|
cp -f \
|
|
awx-operator/hack/publish-to-operator-hub.sh \
|
|
awx-operator-${{ env.VERSION }}/hack/publish-to-operator-hub.sh
|
|
cp -f \
|
|
awx-operator/Makefile \
|
|
awx-operator-${{ env.VERSION }}/Makefile
|
|
|
|
- name: Build and publish bundle to operator-hub
|
|
working-directory: awx-operator-${{ env.VERSION }}
|
|
env:
|
|
IMG_REPOSITORY: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REGISTRY_ORGANIZATION }}
|
|
GITHUB_TOKEN: ${{ secrets.AWX_AUTO_GITHUB_TOKEN }}
|
|
run: |
|
|
git config --global user.email "awx-automation@redhat.com"
|
|
git config --global user.name "AWX Automation"
|
|
./hack/publish-to-operator-hub.sh
|