From ec66b18fa0b67e048ae880f5610a0efd7799c3fb Mon Sep 17 00:00:00 2001 From: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com> Date: Thu, 25 Jul 2024 05:40:59 +0200 Subject: [PATCH] chore: fix release process issues Signed-off-by: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com> --- .../release-please/release-please-config.json | 9 ++-- .github/workflows/chart-release-pr.yml | 8 +++- .../workflows/chart-release-update-config.yml | 42 +++++++++++++++++++ .github/workflows/chart-release.yaml | 4 +- .github/workflows/repo-pr-conventions.yaml | 3 ++ scripts/generate-release-notes.sh | 6 +-- 6 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/chart-release-update-config.yml diff --git a/.github/config/release-please/release-please-config.json b/.github/config/release-please/release-please-config.json index 1b58bb4aa7..1fd8eec2af 100644 --- a/.github/config/release-please/release-please-config.json +++ b/.github/config/release-please/release-please-config.json @@ -5,17 +5,18 @@ "bump-minor-pre-major": false, "prerelease": false, "draft": false, + "last-release-sha": "084debddc1e8b6e78ee901e387065e00162479e4", "packages": { "charts/camunda-platform-latest": { "release-type": "helm", "extra-label": "version/8.5,automation/release-please,release/pr,kind/chore,chart/camunda-platform", - "component": "camunda-platform", + "component": "camunda-platform-latest", "include-v-in-tag": false }, "charts/camunda-platform-8.4": { "release-type": "helm", "extra-label": "version/8.4,automation/release-please,release/pr,kind/chore,chart/camunda-platform", - "component": "camunda-platform", + "component": "camunda-platform-8.4", "include-v-in-tag": false, "extra-files": [ { @@ -28,7 +29,7 @@ "charts/camunda-platform-8.3": { "release-type": "helm", "extra-label": "version/8.3,automation/release-please,release/pr,kind/chore,chart/camunda-platform", - "component": "camunda-platform", + "component": "camunda-platform-8.3", "include-v-in-tag": false, "extra-files": [ { @@ -41,7 +42,7 @@ "charts/camunda-platform-8.2": { "release-type": "helm", "extra-label": "version/8.2,automation/release-please,release/pr,kind/chore,chart/camunda-platform", - "component": "camunda-platform", + "component": "camunda-platform-8.2", "include-v-in-tag": false, "extra-files": [ { diff --git a/.github/workflows/chart-release-pr.yml b/.github/workflows/chart-release-pr.yml index e281b07d25..883f27c79f 100644 --- a/.github/workflows/chart-release-pr.yml +++ b/.github/workflows/chart-release-pr.yml @@ -9,6 +9,10 @@ permissions: contents: write pull-requests: write +env: + RELEASE_PLEASE_CONFIG_FILE: .github/config/release-please/release-please-config.json + RELEASE_PLEASE_MANIFEST_FILE: .github/config/release-please/.release-please-manifest.json + jobs: release-please: name: Run Release Please @@ -24,5 +28,5 @@ jobs: with: token: '${{ steps.generate-github-token.outputs.token }}' # Config docs: https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md - config-file: .github/config/release-please/release-please-config.json - manifest-file: .github/config/release-please/.release-please-manifest.json + config-file: "${{ env.RELEASE_PLEASE_CONFIG_FILE }}" + manifest-file: "${{ env.RELEASE_PLEASE_MANIFEST_FILE }}" diff --git a/.github/workflows/chart-release-update-config.yml b/.github/workflows/chart-release-update-config.yml new file mode 100644 index 0000000000..be005ad59d --- /dev/null +++ b/.github/workflows/chart-release-update-config.yml @@ -0,0 +1,42 @@ +name: "Chart - Release - Update Config" + +on: + push: + branches: + - main + paths: + - .github/config/release-please/.release-please-manifest.json + +permissions: + contents: write + +env: + RELEASE_PLEASE_CONFIG: ".github/config/release-please/release-please-config.json" + +jobs: + # A workaround for https://github.com/googleapis/release-please/issues/2202 + update-config: + name: Update release-please config + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + fetch-depth: 0 + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Get latest release commit + run: | + last_release_commit="$(git log -n1 --pretty=format:'%H' --grep='chore(release):')" + cat "${RELEASE_PLEASE_CONFIG_FILE}" | + jq --arg last_release_commit "${last_release_commit}" \ + '."last-release-sha" = $last_release_commit' | tee "${RELEASE_PLEASE_CONFIG_FILE}" + - name: Git pull + run: git pull --rebase --autostash . + - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 + with: + author_name: "distro-ci[bot]" + author_email: "122795778+distro-ci[bot]@users.noreply.github.com" + message: "chore(release): update release-please config" diff --git a/.github/workflows/chart-release.yaml b/.github/workflows/chart-release.yaml index f191292e2a..f8b4b040b6 100644 --- a/.github/workflows/chart-release.yaml +++ b/.github/workflows/chart-release.yaml @@ -163,11 +163,11 @@ jobs: - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: - # The verification step happens in the "release" branch before merging into the "main" branch. + # The verification step happens in the release branch before merging into the "main" branch. fetch-depth: 0 + ref: release-please--branches--main - name: Install env dependencies uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 - # NOTE: This simple test is under review. So it could fail (it should be fixed in that case). - name: Simple smoke test uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3 with: diff --git a/.github/workflows/repo-pr-conventions.yaml b/.github/workflows/repo-pr-conventions.yaml index a34bb74b3e..cc36194bc4 100644 --- a/.github/workflows/repo-pr-conventions.yaml +++ b/.github/workflows/repo-pr-conventions.yaml @@ -28,6 +28,9 @@ jobs: # Configure additional validation for the subject based on a regex. # Ensures the subject doesn't start with an uppercase character. subjectPattern: ^(?![A-Z]).+$ + # Ignore release PR since it's different and already automated. + ignoreLabels: | + release/pr # When using "Squash and merge" on a PR with only one commit, GitHub # will suggest using that commit message instead of the PR title for the # merge commit, and it's easy to commit this by mistake. Enable this option diff --git a/scripts/generate-release-notes.sh b/scripts/generate-release-notes.sh index 93a282abac..a19dc26fef 100644 --- a/scripts/generate-release-notes.sh +++ b/scripts/generate-release-notes.sh @@ -8,9 +8,7 @@ main () { chart_file="${chart_dir}/Chart.yaml" chart_name="$(yq '.name' ${chart_file})" chart_version="$(yq '.version' ${chart_file})" - chart_version_previous="$(git show main:${chart_file} | yq '.version')" chart_tag="${chart_name}-${chart_version}" - chart_tag_previous="${chart_name}-${chart_version_previous}" # # Early exit if the tag already exists. @@ -26,10 +24,10 @@ main () { # Generate RELEASE-NOTES.md file (used for Github release notes and ArtifactHub "changes" annotation). git-chglog \ --output "${chart_dir}/RELEASE-NOTES.md" \ - --tag-filter-pattern "${chart_tag}" \ + --tag-filter-pattern "${chart_name}" \ --next-tag "${chart_tag}" \ --path "${chart_dir}" \ - "${chart_tag_previous}".."${chart_tag}" + "${chart_tag}" # # Update ArtifactHub "changes" annotation in the Chart.yaml file.