Skip to content

Commit

Permalink
Release process for OperatorHub
Browse files Browse the repository at this point in the history
  • Loading branch information
mabartos committed Oct 27, 2022
1 parent cbf8306 commit b1471fd
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/env/keycloak-rel
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ mvn-releases-url=https://s01.oss.sonatype.org/service/local/repositories/release
mvn-snapshots-url=https://s01.oss.sonatype.org/content/repositories/snapshots/

quay-org=keycloak
docker-org=keycloak
docker-org=keycloak

community-operators-repo=https://github.com/k8s-operatorhub/community-operators.git
prod-operators-repo=https://github.com/redhat-openshift-ecosystem/community-operators-prod.git
5 changes: 4 additions & 1 deletion .github/env/keycloak-rel-testing
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ mvn-releases-url=https://maven.pkg.github.com/keycloak-rel-testing/maven
mvn-snapshots-url=https://maven.pkg.github.com/keycloak-rel-testing/maven

quay-org=keycloaktesting
docker-org=keycloaktesting
docker-org=keycloaktesting

community-operators-repo=https://github.com/keycloak-rel-testing/community-operators.git
prod-operators-repo=https://github.com/keycloak-rel-testing/community-operators-prod.git
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ on:
workflow_dispatch:
inputs:
branch:
description: 'Keycloak branch'
required: true
version:
description: 'New version'
required: true
previous-version:
description: 'Old version'
required: true

concurrency: rel-${{ github.ref }}
Expand All @@ -22,6 +27,7 @@ jobs:
- run: |
echo "Version: ${{ inputs.version }} " >> $GITHUB_STEP_SUMMARY
echo "Release branch: ${{ inputs.branch }} " >> $GITHUB_STEP_SUMMARY
echo "Previous Keycloak version: ${{ inputs.previous-version }} " >> $GITHUB_STEP_SUMMARY
echo "Workflow branch: ${{ github.ref_name }} " >> $GITHUB_STEP_SUMMARY
env:
Expand Down Expand Up @@ -171,3 +177,20 @@ jobs:
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-keycloak-operator-hub:
name: Publish Keycloak Operator to OperatorHub
needs: [ env, create-tags, keycloak-operator ]
uses: ./.github/workflows/x-keycloak-operator-hub-publish.yml
with:
gh-org: ${{ needs.env.outputs.gh-org }}
quay-org: ${{ needs.env.outputs.quay-org }}
mvn-url: ${{ needs.env.outputs.mvn-releases-url }}
version: ${{ github.event.inputs.version }}
previous-version: ${{ github.event.inputs.previous-version }}
community-operators-repo: ${{ needs.env.outputs.community-operators-repo }}
prod-operators-repo: ${{ needs.env.outputs.prod-operators-repo }}
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
MVN_USERNAME: ${{ secrets.MVN_USERNAME }}
MVN_TOKEN: ${{ secrets.MVN_TOKEN }}
8 changes: 8 additions & 0 deletions .github/workflows/x-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ on:
docker-org:
description: "Docker Organization"
value: ${{ jobs.env.outputs.docker-org }}
community-operators-repo:
description: "Community operators repository"
value: ${{ jobs.env.outputs.community-operators-repo }}
prod-operators-repo:
description: "Product operators repository"
value: ${{ jobs.env.outputs.prod-operators-repo }}

defaults:
run:
Expand All @@ -32,6 +38,8 @@ jobs:
mvn-snapshots-url: ${{ env.mvn-snapshots-url }}
quay-org: ${{ env.quay-org }}
docker-org: ${{ env.docker-org }}
community-operators-repo: ${{ env.community-operators-repo }}
prod-operators-repo: ${{ env.prod-operators-repo }}
steps:
- uses: actions/checkout@v3
- id: load-env
Expand Down
135 changes: 135 additions & 0 deletions .github/workflows/x-keycloak-operator-hub-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: X Keycloak Operator Hub publish

on:
workflow_call:
inputs:
gh-org:
required: true
type: string
quay-org:
required: true
type: string
community-operators-repo:
required: true
type: string
prod-operators-repo:
required: true
type: string
mvn-url:
required: true
type: string
version:
required: true
type: string
previous-version:
required: true
type: string
secrets:
GH_TOKEN:
required: true
MVN_USERNAME:
required: true
MVN_TOKEN:
required: true

defaults:
run:
shell: bash

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Setup Java
uses: actions/setup-java@v3.0.0
with:
distribution: 'temurin'
java-version: 11

- name: Checkout Repository
uses: actions/checkout@v3.0.0
with:
repository: '${{ inputs.gh-org }}/keycloak'
token: ${{ secrets.GH_TOKEN }}
ref: ${{ inputs.version }}
path: keycloak

- name: Build
env:
MAVEN_ID: kc-rel-repository
MAVEN_URL: ${{ inputs.mvn-url }}
MAVEN_USERNAME: ${{ secrets.MVN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MVN_TOKEN }}
working-directory: keycloak
run: |
./mvnw clean package \
-s ./.github/mvn-rel-settings.xml \
-f operator/pom.xml \
-DskipTests
- name: Install Yq
working-directory: keycloak
run: sudo snap install yq

- name: Create OLM Bundle
run: |
cd operator && ./scripts/create-olm-bundle.sh ${{ inputs.version }} ${{ inputs.previous-version }} quay.io/${{ inputs.quay-org }}/keycloak-operator
echo "olm_bundle_dir=$(pwd)/olm/${{ inputs.version }}" >> $GITHUB_ENV
- name: Clone community-operators
uses: actions/checkout@v3
with:
repository: keycloak-rel-testing/community-operators
path: community-operators
token: ${{ secrets.GH_TOKEN }}

- name: Automatic Community PR opening
working-directory: community-operators
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git remote add upstream ${{ inputs.community-operators-repo }}
git fetch upstream
git checkout upstream/main -B releases/${{ inputs.version }}
mkdir -p operators/keycloak-operator/${{ inputs.version }}
cp -r ${{ env.olm_bundle_dir }}/* operators/keycloak-operator/${{ inputs.version }}/
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .
git commit -s -m "Bump Keycloak operator to ${{ inputs.version }}"
git push origin HEAD --force
gh pr create --title "Bump Keycloak operator to ${{ inputs.version }}" --fill --repo ${{ inputs.community-operators-repo }}
- name: Clone community-operators-prod
uses: actions/checkout@v3
with:
repository: keycloak-rel-testing/community-operators-prod
path: community-operators-prod
token: ${{ secrets.GH_TOKEN }}

- name: Automatic Prod PR opening
working-directory: community-operators-prod
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git remote add upstream ${{ inputs.prod-operators-repo }}
git fetch upstream
git checkout upstream/main -B releases/${{ inputs.version }}
mkdir -p operators/keycloak-operator/${{ inputs.version }}
cp -r ${{ env.olm_bundle_dir }}/* operators/keycloak-operator/${{ inputs.version }}/
git add .
git commit -s -m "Bump Keycloak operator to ${{ inputs.version }}"
git push origin HEAD --force
gh pr create --title "Bump Keycloak operator to ${{ inputs.version }}" --fill --repo ${{ inputs.prod-operators-repo }}

0 comments on commit b1471fd

Please sign in to comment.