Release #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 1.0.1)' | |
| required: true | |
| type: string | |
| env: | |
| REGISTRY: ghcr.io | |
| CONTROLLER_IMAGE: ghcr.io/${{ github.repository }} | |
| OPERATOR_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-operator-controller | |
| PLUGIN_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-console-plugin | |
| BUNDLE_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-operator-bundle | |
| CATALOG_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-operator-catalog | |
| # Platforms to build for. Keep this single-sourced to make release changes simpler. | |
| PLATFORMS: linux/arm64,linux/amd64 | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| prepare: | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| version_tag: ${{ steps.version.outputs.version_tag }} | |
| steps: | |
| - name: Determine Version | |
| id: version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| fi | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Release version: ${VERSION}" | |
| build-controller: | |
| name: Build and Push Controller | |
| needs: prepare | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Run Tests | |
| run: make test | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Controller Image | |
| run: | | |
| make docker-buildx \ | |
| IMG=${{ env.CONTROLLER_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| PLATFORMS=${{ env.PLATFORMS }} | |
| - name: Tag Latest | |
| run: | | |
| docker buildx imagetools create \ | |
| ${{ env.CONTROLLER_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| --tag ${{ env.CONTROLLER_IMAGE }}:latest | |
| build-plugin: | |
| name: Build and Push Console Plugin | |
| needs: prepare | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install Dependencies | |
| working-directory: object-lease-console-plugin | |
| run: yarn install | |
| - name: Build Plugin | |
| working-directory: object-lease-console-plugin | |
| run: yarn build | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Plugin Image | |
| run: | | |
| make plugin-buildx \ | |
| PLUGIN_IMG=${{ env.PLUGIN_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| PLATFORMS=${{ env.PLATFORMS }} | |
| - name: Tag Latest | |
| run: | | |
| docker buildx imagetools create \ | |
| ${{ env.PLUGIN_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| --tag ${{ env.PLUGIN_IMAGE }}:latest | |
| build-operator: | |
| name: Build and Push Operator | |
| needs: [prepare, build-controller] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Operator Image | |
| working-directory: object-lease-operator | |
| run: | | |
| make docker-buildx \ | |
| IMG=${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| VERSION=${{ needs.prepare.outputs.version }} \ | |
| PLATFORMS=${{ env.PLATFORMS }} | |
| - name: Tag Latest | |
| run: | | |
| docker buildx imagetools create \ | |
| ${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| --tag ${{ env.OPERATOR_IMAGE }}:latest | |
| build-bundle: | |
| name: Build and Push Operator Bundle | |
| needs: [prepare, build-operator] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Bundle | |
| working-directory: object-lease-operator | |
| run: | | |
| make bundle-push \ | |
| IMG=${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| BUNDLE_IMG=${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| VERSION=${{ needs.prepare.outputs.version }} | |
| - name: Tag Latest | |
| run: | | |
| docker buildx imagetools create \ | |
| ${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| --tag ${{ env.BUNDLE_IMAGE }}:latest | |
| build-catalog: | |
| name: Build and Push Operator Catalog | |
| needs: [prepare, build-bundle] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Catalog | |
| working-directory: object-lease-operator | |
| run: | | |
| make catalog-push \ | |
| BUNDLE_IMGS=${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| CATALOG_IMG=${{ env.CATALOG_IMAGE }}:${{ needs.prepare.outputs.version_tag }} | |
| - name: Tag Latest | |
| run: | | |
| docker buildx imagetools create \ | |
| ${{ env.CATALOG_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \ | |
| --tag ${{ env.CATALOG_IMAGE }}:latest | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [prepare, build-controller, build-plugin, build-operator, build-bundle, build-catalog] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate Release Notes | |
| id: release_notes | |
| run: | | |
| cat << 'FEOF' > release_notes.md | |
| ## Object Lease Controller v${{ needs.prepare.outputs.version_tag }} | |
| ### Container Images | |
| - **Controller**: `${{ env.CONTROLLER_IMAGE }}:${{ needs.prepare.outputs.version_tag }}` | |
| - **Console Plugin**: `${{ env.PLUGIN_IMAGE }}:${{ needs.prepare.outputs.version_tag }}` | |
| - **Operator**: `${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }}` | |
| - **Bundle**: `${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }}` | |
| - **Catalog**: `${{ env.CATALOG_IMAGE }}:${{ needs.prepare.outputs.version_tag }}` | |
| ### Installation | |
| #### Install Operator from Catalog | |
| ```bash | |
| kubectl apply -f - <<EOF | |
| apiVersion: operators.coreos.com/v1alpha1 | |
| kind: CatalogSource | |
| metadata: | |
| name: object-lease-operator-catalog | |
| namespace: openshift-marketplace | |
| spec: | |
| sourceType: grpc | |
| image: ${{ env.CATALOG_IMAGE }}:latest | |
| displayName: Object Lease Operator | |
| publisher: ullbergm | |
| updateStrategy: | |
| registryPoll: | |
| interval: 10m | |
| EOF | |
| ``` | |
| #### Direct Deployment | |
| ```bash | |
| kubectl apply -k github.com/ullbergm/object-lease-controller/object-lease-operator/config/default?ref=${{ needs.prepare.outputs.version_tag }} | |
| ``` | |
| FEOF | |
| cat release_notes.md | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.prepare.outputs.version_tag }} | |
| name: Release ${{ needs.prepare.outputs.version_tag }} | |
| body_path: release_notes.md | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true |