diff --git a/.github/workflows/csm-release-driver-module.yaml b/.github/workflows/csm-release-driver-module.yaml index e9be32e..616f78c 100644 --- a/.github/workflows/csm-release-driver-module.yaml +++ b/.github/workflows/csm-release-driver-module.yaml @@ -12,14 +12,15 @@ name: Release CSM Drivers and Modules # Invocable as a reusable workflow on: workflow_call: - workflow_dispatch: inputs: version: description: 'Version to release (major, minor, patch), ex: 1.0.0' required: true + type: string image: description: 'Image name, ex: csm-powerstore' required: true + type: string jobs: build-and-scan: @@ -59,56 +60,61 @@ jobs: needs: build-and-scan runs-on: ubuntu-latest steps: - - name: Log in to Quay.io - run: echo "${{ secrets.QUAY_PASSWORD }}" | docker login quay.io -u "${{ secrets.QUAY_USERNAME }}" --password-stdin + - name: Image name + run: echo "Image name:" "${{ inputs.image }}" + # - name: Log in to Quay.io + # run: echo "${{ secrets.QUAY_PASSWORD }}" | docker login quay.io -u "${{ secrets.QUAY_USERNAME }}" --password-stdin - - name: Log in to Docker Hub - run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login docker.io -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin + # - name: Log in to Docker Hub + # run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login docker.io -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin - - name: Pull nightly image from Quay.io - run: docker pull quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:nightly + # - name: Pull nightly image from Quay.io + # run: docker pull quay.io/dell/container-storage-modules/${{ inputs.image }}:nightly - - name: Retag image for Quay.io - run: | - docker tag quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:nightly quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:v${{ github.event.inputs.version }} + # - name: Retag image for Quay.io + # run: | + # docker tag quay.io/dell/container-storage-modules/${{ inputs.image }}:nightly quay.io/dell/container-storage-modules/${{ inputs.image }}:v${{ inputs.version }} + + # docker tag quay.io/dell/container-storage-modules/${{ inputs.image }}:nightly quay.io/dell/container-storage-modules/${{ inputs.image }}:latest - docker tag quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:nightly quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:latest + # - name: Retag image for Docker Hub + # run: | + # docker tag quay.io/dell/container-storage-modules/${{ inputs.image }}:nightly dellemc/${{ inputs.image }}:v${{ inputs.version }} - - name: Retag image for Docker Hub - run: | - docker tag quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:nightly dellemc/${{ github.event.inputs.image }}:v${{ github.event.inputs.version }} + # docker tag quay.io/dell/container-storage-modules/${{ inputs.image }}:nightly dellemc/${{ inputs.image }}:latest - docker tag quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:nightly dellemc/${{ github.event.inputs.image }}:latest + # - name: Push ${{ inputs.version }} and latest tag to Quay.io + # run: | + # docker push quay.io/dell/container-storage-modules/${{ inputs.image }}:v${{ inputs.version }} + # docker push quay.io/dell/container-storage-modules/${{ inputs.image }}:latest - - name: Push ${{ github.event.inputs.version }} and latest tag to Quay.io - run: | - docker push quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:v${{ github.event.inputs.version }} - docker push quay.io/dell/container-storage-modules/${{ github.event.inputs.image }}:latest - - - name: Push ${{ github.event.inputs.version }} and latest tag to Docker Hub - run: | - docker push dellemc/${{ github.event.inputs.image }}:v${{ github.event.inputs.version }} - docker push dellemc/${{ github.event.inputs.image }}:latest + # - name: Push ${{ inputs.version }} and latest tag to Docker Hub + # run: | + # docker push dellemc/${{ inputs.image }}:v${{ inputs.version }} + # docker push dellemc/${{ inputs.image }}:latest create-release: name: Create Release needs: push-images runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Create new tag run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' - git tag v${{ github.event.inputs.version }} - git push origin v${{ github.event.inputs.version }} + git tag v${{ inputs.version }} + git push origin v${{ inputs.version }} # TODO: attach built binaries to the release - name: Create Release id: release_notes uses: softprops/action-gh-release@v2 with: - tag_name: v${{ github.event.inputs.version }} - name: Release v${{ github.event.inputs.version }} + tag_name: v${{ inputs.version }} + name: Release v${{ inputs.version }} draft: true prerelease: false generate_release_notes: true @@ -126,5 +132,5 @@ jobs: run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' - git checkout -b release/v${{ github.event.inputs.version }} - git push origin release/v${{ github.event.inputs.version }} + git checkout -b release/v${{ inputs.version }} + git push origin release/v${{ inputs.version }} diff --git a/.github/workflows/trigger-auto-csm-release-workflow.yaml b/.github/workflows/trigger-auto-csm-release-workflow.yaml new file mode 100644 index 0000000..eec4f3a --- /dev/null +++ b/.github/workflows/trigger-auto-csm-release-workflow.yaml @@ -0,0 +1,51 @@ +# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# Trigger workflow for auto release of CSM projects +name: Trigger Release of CSM Drivers and Modules + +on: + workflow_dispatch: + +jobs: + trigger: + name: Trigger Release of CSM Drivers and Modules + runs-on: ubuntu-latest + + strategy: + matrix: + repo: + [ + "dell/csi-metadata-retriever", + "dell/csi-powerflex", + "dell/csi-powermax", + "dell/csi-powerscale", + "dell/csi-powerstore", + "dell/csi-unity", + "dell/csm-metrics-powermax", + "dell/csm-metrics-powerscale", + "dell/csm-metrics-powerstore", + "dell/csm-metrics-unity", + "dell/csm-operator", + "dell/csm-replication", + "dell/karavi-authorization" + "dell/karavi-resiliency" + "dell/karavi-observability" + "dell/karavi-metrics-powerflex" + "dell/karavi-topology" + ] + + steps: + - name: Trigger Release of CSM Drivers and Modules + uses: peter-evans/repository-dispatch@v3 + with: + # For token information, see: https://github.com/peter-evans/repository-dispatch/tree/main?tab=readme-ov-file#token + token: ${{ secrets.CSMBOT_PAT }} + repository: ${{ matrix.repo }} + event-type: auto-release-workflow + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' diff --git a/README.md b/README.md index 03da3a9..eade90a 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,88 @@ jobs: uses: dell/common-github-actions/.github/workflows/go-common.yml@main ``` +### csm-release-driver-module + +This workflow automates the release of CSM drivers and modules repositories. The workflow accepts two parameters as version and image, and can be used from any repo by creating a workflow that resembles the following. +The manual workflow is recommended to be used for out of band releases such as patch releases or when the increment is a major version change. + +For manual trigger from driver and module repositories, here is the example for the csi-powerscale repo: + +```yaml +name: Release CSIPowerScale +on: + workflow_call: + workflow_dispatch: + inputs: + version: + description: 'Version to release (major, minor, patch) Ex: 1.0.0' + required: true + image: + description: 'Image name to release Ex: csi-isilon' + required: true + +jobs: + release: + uses: dell/common-github-actions/.github/workflows/csm-release-driver-module.yaml@main + name: Release CSM Drivers and Modules + with: + version: ${{ github.event.inputs.version }} + image: ${{ github.event.inputs.image }} + secrets: inherit +``` + +For Auto release of the driver and module repositories, here is the example for the csi-powerscale repo: + +```yaml +name: Auto Release CSIPowerScale +on: + workflow_dispatch: + repository_dispatch: + types: [auto-release-workflow] + +jobs: + calculate-version: + runs-on: ubuntu-latest + outputs: + new-version: ${{ steps.set-version.outputs.version }} + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch the full history including tags + + - name: Get latest release version + id: get-latest-version + run: | + latest_version=$(git describe --tags $(git rev-list --tags --max-count=1)) + echo "latest_version=${latest_version}" >> $GITHUB_ENV + + - name: Increment minor version and remove 'v' prefix + id: set-version + run: | + version=${{ env.latest_version }} + clean_version=${version#v} + + # Parse version parts + major=$(echo $clean_version | cut -d'.' -f1) + minor=$(echo $clean_version | cut -d'.' -f2) + patch=$(echo $clean_version | cut -d'.' -f3) + new_minor=$((minor + 1)) + new_version="${major}.${new_minor}.0" + + echo "New version: $new_version" + echo "::set-output name=version::$new_version" + + csm-release: + needs: calculate-version + uses: dell/common-github-actions/.github/workflows/csm-release-driver-module.yaml@main + with: + version: ${{ inputs.version || needs.calculate-version.outputs.new-version }} + image: "csi-isilon" # Please provide the appropriate image name + secrets: inherit +``` + + ## Support Don’t hesitate to ask! Contact the team and community on [our support](./docs/SUPPORT.md).