Skip to content

Commit

Permalink
[release-0.1] Add release workflow (#333)
Browse files Browse the repository at this point in the history
* Add release workflow

Signed-off-by: bmangoen <bmangoen@redhat.com>

* Use github.actor vars

Signed-off-by: bmangoen <bmangoen@redhat.com>

* Workflow in the right directory

Signed-off-by: bmangoen <bmangoen@redhat.com>

---------

Signed-off-by: bmangoen <bmangoen@redhat.com>
Co-authored-by: bmangoen <bmangoen@redhat.com>
  • Loading branch information
istio-testing and bmangoen committed Sep 12, 2024
1 parent 5b1bb9a commit ca0b178
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release workflow

on:
workflow_dispatch:
inputs:
release_version:
description: "Release version"
required: true
bundle_channels:
description: "Bundle channels"
required: true
default: "candidates"
is_draft_release:
description: "Draft release"
type: boolean
required: false
default: true
is_pre_release:
description: "Pre-release"
type: boolean
required: false
default: false

run-name: Release ${{ inputs.release_version }}

env:
GIT_USER: ${{ secrets.GIT_USER }}
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
VERSION: ${{ inputs.release_version }}

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PWD }}

- uses: actions/checkout@v4

- name: Build and push operator image
run: |
make docker-buildx \
-e TAG=$VERSION
- name: Generate bundle metadata
run: |
make bundle \
-e CHANNELS=$CHANNELS
env:
CHANNELS: ${{ inputs.bundle_channels }}

- name: Publish bundle in operatorhub.io
run: |
make bundle-publish \
-e GIT_CONFIG_USER_NAME="$GIT_CONFIG_USER_NAME" \
-e GIT_CONFIG_USER_EMAIL="$GIT_CONFIG_USER_EMAIL" \
-e OPERATOR_VERSION=$VERSION \
-e OPERATOR_HUB=community-operators \
-e OWNER=k8s-operatorhub \
-e FORK=maistra
env:
GIT_CONFIG_USER_NAME: "${{ github.actor }}"
GIT_CONFIG_USER_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"

- name: Publish bundle in OpenShift OperatorHub
run: |
make bundle-publish \
-e GIT_CONFIG_USER_NAME="$GIT_CONFIG_USER_NAME" \
-e GIT_CONFIG_USER_EMAIL="$GIT_CONFIG_USER_EMAIL" \
-e OPERATOR_VERSION=$VERSION \
-e OWNER=redhat-openshift-ecosystem \
-e FORK=maistra
env:
GIT_CONFIG_USER_NAME: "${{ github.actor }}"
GIT_CONFIG_USER_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"

- name: Create GitHub release
run: |
make create-gh-release \
-e GH_PRE_RELEASE=$GH_PRE_RELEASE \
-e GH_RELEASE_DRAFT=$GH_RELEASE_DRAFT
env:
GH_PRE_RELEASE: ${{ github.event.inputs.is_pre_release == 'true' }}
GH_RELEASE_DRAFT: ${{ github.event.inputs.is_draft_release == 'true' }}
11 changes: 11 additions & 0 deletions hack/operatorhub/publish-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ source "${CUR_DIR}"/../validate_semver.sh
GITHUB_TOKEN="${GITHUB_TOKEN:-}"
GIT_USER="${GIT_USER:-}"

GIT_CONFIG_USER_NAME="${GIT_CONFIG_USER_NAME:-}"
GIT_CONFIG_USER_EMAIL="${GIT_CONFIG_USER_EMAIL:-}"

# The OPERATOR_NAME is defined in Makefile
: "${OPERATOR_NAME:?"Missing OPERATOR_NAME variable"}"
: "${OPERATOR_VERSION:?"Missing OPERATOR_VERSION variable"}"
Expand Down Expand Up @@ -96,6 +99,14 @@ BUNDLE_DIR="${CUR_DIR}"/../../bundle
mkdir -p "${OPERATORS_DIR}"
cp -a "${BUNDLE_DIR}"/. "${OPERATORS_DIR}"

if ! git config --global user.name; then
skipInDryRun git config --global user.name "${GIT_CONFIG_USER_NAME}"
fi

if ! git config --global user.email; then
skipInDryRun git config --global user.email "${GIT_CONFIG_USER_EMAIL}"
fi

TITLE="operator ${OPERATOR_NAME} (${OPERATOR_VERSION})"
skipInDryRun git add .
skipInDryRun git commit -s -m"${TITLE}"
Expand Down

0 comments on commit ca0b178

Please sign in to comment.