From 8c83428e3ecbe18e083c95f3470d6b385028264f Mon Sep 17 00:00:00 2001 From: Derek Su Date: Tue, 10 Sep 2024 14:30:35 +0800 Subject: [PATCH] fix(release): support release without longhorn-cli Signed-off-by: Derek Su --- .github/workflows/release-preview.yml | 204 +++++++++++++++----------- .github/workflows/release.yml | 177 ++++++++++++---------- 2 files changed, 219 insertions(+), 162 deletions(-) diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml index bdc1361..aa90656 100644 --- a/.github/workflows/release-preview.yml +++ b/.github/workflows/release-preview.yml @@ -74,20 +74,26 @@ jobs: - id: pr name: Create a release PR (for updating the version file) run: | - renote pr \ - --owner longhorn \ - --repo longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --tag ${{ steps.var.outputs.tag }} \ - --longhorn-chart-repo charts \ - --longhorn-repos longhorn-manager \ - --longhorn-repos longhorn-engine \ - --longhorn-repos longhorn-instance-manager \ - --longhorn-repos longhorn-share-manager \ - --longhorn-repos backing-image-manager \ - --longhorn-repos longhorn-ui \ - --longhorn-repos cli:longhorn-cli \ + common_args=( + --owner longhorn + --repo longhorn + --branch "${{ steps.var.outputs.branch }}" + --tag "${{ steps.var.outputs.tag }}" + --longhorn-chart-repo charts + --longhorn-repos longhorn-manager + --longhorn-repos longhorn-engine + --longhorn-repos longhorn-instance-manager + --longhorn-repos longhorn-share-manager + --longhorn-repos backing-image-manager + --longhorn-repos longhorn-ui --merge + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + common_args+=(--longhorn-repos cli:longhorn-cli) + fi + + renote pr "${common_args[@]}" - id: artifact name: Collect artifacts @@ -97,36 +103,49 @@ jobs: - id: tag name: Create a tag for each release repo run: | - renote tag \ - --owner longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --tag ${{ steps.var.outputs.tag }} \ - --create-version-file \ - --version-file-repos longhorn-manager \ - --version-file-repos longhorn-engine \ - --version-file-repos longhorn-instance-manager \ - --version-file-repos longhorn-share-manager \ - --version-file-repos backing-image-manager \ - --version-file-repos longhorn-ui \ - --version-file-repos cli \ - --repos longhorn \ + common_args=( + --owner longhorn + --branch "${{ steps.var.outputs.branch }}" + --tag "${{ steps.var.outputs.tag }}" + --create-version-file + --version-file-repos longhorn-manager + --version-file-repos longhorn-engine + --version-file-repos longhorn-instance-manager + --version-file-repos longhorn-share-manager + --version-file-repos backing-image-manager + --version-file-repos longhorn-ui + --repos longhorn --force + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + common_args+=(--version-file-repos cli) + fi + + renote tag "${common_args[@]}" - id: changelog-prev-tag name: Create a changelog from the most previous tag run: | + repos=( + longhorn-manager + longhorn-engine + longhorn-instance-manager + longhorn-share-manager + backing-image-manager + longhorn-ui + longhorn + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + repos+=(cli) + fi + output=$(renote changelog \ --owner longhorn \ --branch ${{ steps.var.outputs.branch }} \ --tag ${{ steps.var.outputs.tag }} \ - --repos longhorn-manager \ - --repos longhorn-engine \ - --repos longhorn-instance-manager \ - --repos longhorn-share-manager \ - --repos backing-image-manager \ - --repos longhorn-ui \ - --repos cli \ - --repos longhorn) + $(printf -- '--repos %s ' "${repos[@]}")) echo "$output" echo "$output" > ./changelog-prev-tag.md @@ -134,20 +153,27 @@ jobs: - id: changelog name: Create a changelog from the last release run: | + repos=( + longhorn-manager + longhorn-engine + longhorn-instance-manager + longhorn-share-manager + backing-image-manager + longhorn-ui + longhorn + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + repos+=(cli) + fi + output=$(renote changelog \ --log-level error \ --owner longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --tag ${{ steps.var.outputs.tag }} \ - --prev-tag ${{ steps.var.outputs.prev_tag }} \ - --repos longhorn-manager \ - --repos longhorn-engine \ - --repos longhorn-instance-manager \ - --repos longhorn-share-manager \ - --repos backing-image-manager \ - --repos longhorn-ui \ - --repos cli \ - --repos longhorn) + --branch "${{ steps.var.outputs.branch }}" \ + --tag "${{ steps.var.outputs.tag }}" \ + --prev-tag "${{ steps.var.outputs.prev_tag }}" \ + $(printf -- '--repos %s ' "${repos[@]}")) echo "$output" echo "$output" > ./changelog.md @@ -155,45 +181,51 @@ jobs: - id: release name: Create a release run: | - renote release \ - --owner longhorn \ - --repo longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --tag ${{ steps.var.outputs.tag }} \ - --milestone ${{ steps.var.outputs.milestone }} \ - --pre-note ./assets/release-preview/pre-note.md \ - --note-contributors innobead \ - --since-days 365 \ - --exclude-labels "kind/test" \ - --exclude-labels "area/infra" \ - --exclude-labels "area/ci" \ - --exclude-labels "area/qa" \ - --exclude-labels "wontfix" \ - --exclude-labels "duplicated" \ - --exclude-labels "invalid" \ - --exclude-labels "release/task" \ - --note-section-labels "highlight" \ - --note-section-labels "kind/feature" \ - --note-section-labels "kind/improvement" \ - --note-section-labels "kind/bug" \ - --note-section-labels "area/performance" \ - --note-section-labels "area/resilience" \ - --note-section-labels "area/stability" \ - --note-section-labels "area/scalability" \ - --note-section-labels "area/benchmark" \ - --pre-hook ./scripts/check-images-ready.sh \ - --pre-hook-args "longhornio/longhorn-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-engine:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-instance-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-share-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/backing-image-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-ui:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-cli:${{ steps.var.outputs.tag }}" \ - --artifacts ./longhorn.yaml \ - --artifacts ./longhorn-images.txt \ - --artifacts ./charts.tar.gz \ - --artifacts ./changelog.md \ - --artifacts ./changelog-prev-tag.md \ - --artifacts ./longhorn-images-sbom.tar.gz \ - --pre-release \ + common_args=( + --owner longhorn + --repo longhorn + --branch ${{ steps.var.outputs.branch }} + --tag ${{ steps.var.outputs.tag }} + --milestone ${{ steps.var.outputs.milestone }} + --pre-note ./assets/release-preview/pre-note.md + --note-contributors innobead + --since-days 365 + --exclude-labels "kind/test" + --exclude-labels "area/infra" + --exclude-labels "area/ci" + --exclude-labels "area/qa" + --exclude-labels "wontfix" + --exclude-labels "duplicated" + --exclude-labels "invalid" + --exclude-labels "release/task" + --note-section-labels "highlight" + --note-section-labels "kind/feature" + --note-section-labels "kind/improvement" + --note-section-labels "kind/bug" + --note-section-labels "area/performance" + --note-section-labels "area/resilience" + --note-section-labels "area/stability" + --note-section-labels "area/scalability" + --note-section-labels "area/benchmark" + --pre-hook ./scripts/check-images-ready.sh + --pre-hook-args "longhornio/longhorn-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-engine:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-instance-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-share-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/backing-image-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-ui:${{ steps.var.outputs.tag }}" + --artifacts ./longhorn.yaml + --artifacts ./longhorn-images.txt + --artifacts ./charts.tar.gz + --artifacts ./changelog.md + --artifacts ./changelog-prev-tag.md + --artifacts ./longhorn-images-sbom.tar.gz + --pre-release --draft + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + common_args+=(--pre-hook-args "longhornio/longhorn-cli:${{ steps.var.outputs.tag }}") + fi + + renote release "${common_args[@]}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd6fcff..9cdc375 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,20 +74,26 @@ jobs: - id: pr name: Create a release PR (for updating the version file) run: | - renote pr \ - --owner longhorn \ - --repo longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --tag ${{ steps.var.outputs.tag }} \ - --longhorn-chart-repo charts \ - --longhorn-repos longhorn-manager \ - --longhorn-repos longhorn-engine \ - --longhorn-repos longhorn-instance-manager \ - --longhorn-repos longhorn-share-manager \ - --longhorn-repos backing-image-manager \ - --longhorn-repos longhorn-ui \ - --longhorn-repos cli:longhorn-cli \ + common_args=( + --owner longhorn + --repo longhorn + --branch "${{ steps.var.outputs.branch }}" + --tag "${{ steps.var.outputs.tag }}" + --longhorn-chart-repo charts + --longhorn-repos longhorn-manager + --longhorn-repos longhorn-engine + --longhorn-repos longhorn-instance-manager + --longhorn-repos longhorn-share-manager + --longhorn-repos backing-image-manager + --longhorn-repos longhorn-ui --merge + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + common_args+=(--longhorn-repos cli:longhorn-cli) + fi + + renote pr "${common_args[@]}" - id: artifact name: Collect artifacts @@ -97,81 +103,100 @@ jobs: - id: tag name: Create a tag for each release repo run: | - renote tag \ - --owner longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --tag ${{ steps.var.outputs.tag }} \ - --create-version-file \ - --version-file-repos longhorn-manager \ - --version-file-repos longhorn-engine \ - --version-file-repos longhorn-instance-manager \ - --version-file-repos longhorn-share-manager \ - --version-file-repos backing-image-manager \ - --version-file-repos longhorn-ui \ - --version-file-repos cli \ + common_args=( + --owner longhorn + --branch "${{ steps.var.outputs.branch }}" + --tag "${{ steps.var.outputs.tag }}" + --create-version-file + --version-file-repos longhorn-manager + --version-file-repos longhorn-engine + --version-file-repos longhorn-instance-manager + --version-file-repos longhorn-share-manager + --version-file-repos backing-image-manager + --version-file-repos longhorn-ui --force + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + common_args+=(--version-file-repos cli) + fi + + renote tag "${common_args[@]}" - id: changelog name: Create a changelog from the last release run: | + repos=( + longhorn-manager + longhorn-engine + longhorn-instance-manager + longhorn-share-manager + backing-image-manager + longhorn-ui + longhorn + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + repos+=(cli) + fi + output=$(renote changelog \ --log-level error \ --owner longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --prev-tag ${{ steps.var.outputs.prev_tag }} \ - --repos longhorn-manager \ - --repos longhorn-engine \ - --repos longhorn-instance-manager \ - --repos longhorn-share-manager \ - --repos backing-image-manager \ - --repos longhorn-ui \ - --repos cli \ - --repos longhorn) - + --branch "${{ steps.var.outputs.branch }}" \ + --tag "${{ steps.var.outputs.tag }}" \ + --prev-tag "${{ steps.var.outputs.prev_tag }}" \ + $(printf -- '--repos %s ' "${repos[@]}")) echo "$output" echo "$output" > ./changelog.md - id: release name: Create a release run: | - renote release \ - --owner longhorn \ - --repo longhorn \ - --branch ${{ steps.var.outputs.branch }} \ - --tag ${{ steps.var.outputs.tag }} \ - --milestone ${{ steps.var.outputs.milestone }} \ - --pre-note ./assets/release/pre-note.md \ - --note-contributors innobead \ - --since-days 365 \ - --exclude-labels "kind/test" \ - --exclude-labels "area/infra" \ - --exclude-labels "area/ci" \ - --exclude-labels "area/qa" \ - --exclude-labels "wontfix" \ - --exclude-labels "duplicated" \ - --exclude-labels "invalid" \ - --exclude-labels "release/task" \ - --note-section-labels "highlight" \ - --note-section-labels "kind/feature" \ - --note-section-labels "kind/improvement" \ - --note-section-labels "kind/bug" \ - --note-section-labels "area/performance" \ - --note-section-labels "area/resilience" \ - --note-section-labels "area/stability" \ - --note-section-labels "area/scalability" \ - --note-section-labels "area/benchmark" \ - --pre-hook ./scripts/check-images-ready.sh \ - --pre-hook-args "longhornio/longhorn-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-engine:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-instance-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-share-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/backing-image-manager:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-ui:${{ steps.var.outputs.tag }}" \ - --pre-hook-args "longhornio/longhorn-cli:${{ steps.var.outputs.tag }}" \ - --artifacts ./longhorn.yaml \ - --artifacts ./longhorn-images.txt \ - --artifacts ./charts.tar.gz \ - --artifacts ./changelog.md \ - --artifacts ./longhorn-images-sbom.tar.gz \ - --pre-release \ + common_args=( + --owner longhorn + --repo longhorn + --branch ${{ steps.var.outputs.branch }} + --tag ${{ steps.var.outputs.tag }} + --milestone ${{ steps.var.outputs.milestone }} + --pre-note ./assets/release/pre-note.md + --note-contributors innobead + --since-days 365 + --exclude-labels "kind/test" + --exclude-labels "area/infra" + --exclude-labels "area/ci" + --exclude-labels "area/qa" + --exclude-labels "wontfix" + --exclude-labels "duplicated" + --exclude-labels "invalid" + --exclude-labels "release/task" + --note-section-labels "highlight" + --note-section-labels "kind/feature" + --note-section-labels "kind/improvement" + --note-section-labels "kind/bug" + --note-section-labels "area/performance" + --note-section-labels "area/resilience" + --note-section-labels "area/stability" + --note-section-labels "area/scalability" + --note-section-labels "area/benchmark" + --pre-hook ./scripts/check-images-ready.sh + --pre-hook-args "longhornio/longhorn-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-engine:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-instance-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-share-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/backing-image-manager:${{ steps.var.outputs.tag }}" + --pre-hook-args "longhornio/longhorn-ui:${{ steps.var.outputs.tag }}" + --artifacts ./longhorn.yaml + --artifacts ./longhorn-images.txt + --artifacts ./charts.tar.gz + --artifacts ./changelog.md + --artifacts ./longhorn-images-sbom.tar.gz + --pre-release --draft + ) + + if [ "${{ steps.var.outputs.branch }}" != "v1.6.x" ]; then + common_args+=(--pre-hook-args "longhornio/longhorn-cli:${{ steps.var.outputs.tag }}") + fi + + renote release "${common_args[@]}"