From 8e45071174fb96c1dbf1a8a67c17f271c16086ee Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Wed, 27 Nov 2024 22:48:39 +0530 Subject: [PATCH 01/10] update release procedures wrt brew formula Signed-off-by: Faeka Ansari --- .../15-release-procedures.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/docs/40-contributor-guide/15-release-procedures.md b/docs/docs/40-contributor-guide/15-release-procedures.md index eab00608f..dade75f20 100644 --- a/docs/docs/40-contributor-guide/15-release-procedures.md +++ b/docs/docs/40-contributor-guide/15-release-procedures.md @@ -154,6 +154,29 @@ release date -- which is always a Friday. [automated release process](https://github.com/akuity/kargo/actions/workflows/release.yaml) to complete. +1. Update Homebrew Formula. + + * Clone the Homebrew tap repository: + ```bash + git clone https://github.com/akuity/homebrew-tap.git + cd homebrew-tap + ``` + * Run the update script with the new version: + ```bash + ./update.sh kargo vM.m.0 + ``` + * Verify the updated formula: + ```bash + brew install --build-from-source ./kargo.rb + kargo --version + ``` + * Commit and push the changes to the Homebrew tap repository: + ```bash + git add kargo.rb + git commit -m "Update Kargo formula to version vM.m.0" + git push origin main + ``` + 1. Mark the release branch (`release-M.m`) as the __"Production branch"__ [in Netlify](https://app.netlify.com/sites/docs-kargo-akuity-io/configuration/deploys#branches-and-deploy-contexts). From 8e386c20f4173c07bc352a96818f7ebf8a4380e7 Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Wed, 27 Nov 2024 23:04:40 +0530 Subject: [PATCH 02/10] nit: update link Signed-off-by: Faeka Ansari --- docs/docs/40-contributor-guide/15-release-procedures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/40-contributor-guide/15-release-procedures.md b/docs/docs/40-contributor-guide/15-release-procedures.md index dade75f20..cceb615ad 100644 --- a/docs/docs/40-contributor-guide/15-release-procedures.md +++ b/docs/docs/40-contributor-guide/15-release-procedures.md @@ -154,7 +154,7 @@ release date -- which is always a Friday. [automated release process](https://github.com/akuity/kargo/actions/workflows/release.yaml) to complete. -1. Update Homebrew Formula. +1. Update [Homebrew Formula](https://github.com/akuity/homebrew-tap). * Clone the Homebrew tap repository: ```bash From ad26b60413f724a386cbc3563e7d344db41d8704 Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Fri, 29 Nov 2024 01:26:29 +0530 Subject: [PATCH 03/10] add update-homebrew-formula job to release workflow Signed-off-by: Faeka Ansari --- .github/workflows/release.yaml | 39 +++++++++++++++++++ .../15-release-procedures.md | 23 ----------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 531d2d1b6..74ede3f89 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -333,3 +333,42 @@ jobs: base64-subjects: "${{ needs.combine_hashes.outputs.hashes }}" upload-assets: true # Optional: Upload to a new release provenance-name: kargo-cli.intoto.jsonl + update-homebrew-formula: + if: github.event_name == 'release' + permissions: + contents: write # Needed to push changes + pull-requests: write # Needed to create a pull request + runs-on: ubuntu-latest + needs: [ publish-image, publish-cli ] + steps: + - name: Checkout bottle Repository + uses: actions/checkout@v4 + with: + repository: akuity/homebrew-tap + token: ${{ secrets.GITHUB_TOKEN }} + path: homebrew-tap + + - name: Update Homebrew formula + run: | + cd homebrew-tap + ./update.sh kargo ${{ github.ref_name }} + + - name: Configure Git and Commit changes + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + cd homebrew-tap + git checkout -b update-kargo-${{ github.ref_name }} + git add kargo.rb + git commit -m "chore: update Kargo cli to version ${{ github.ref_name }}" + + - name: Push changes and open PR + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update Kargo formula to version ${{ github.ref_name }}" + branch: update-kargo-${{ github.ref_name }} + base: main + title: "chore: update Kargo formula to version ${{ github.ref_name }}" + body: "This PR updates the Homebrew formula for Kargo to version ${{ github.ref_name }}." + delete-branch: 'true' diff --git a/docs/docs/40-contributor-guide/15-release-procedures.md b/docs/docs/40-contributor-guide/15-release-procedures.md index cceb615ad..eab00608f 100644 --- a/docs/docs/40-contributor-guide/15-release-procedures.md +++ b/docs/docs/40-contributor-guide/15-release-procedures.md @@ -154,29 +154,6 @@ release date -- which is always a Friday. [automated release process](https://github.com/akuity/kargo/actions/workflows/release.yaml) to complete. -1. Update [Homebrew Formula](https://github.com/akuity/homebrew-tap). - - * Clone the Homebrew tap repository: - ```bash - git clone https://github.com/akuity/homebrew-tap.git - cd homebrew-tap - ``` - * Run the update script with the new version: - ```bash - ./update.sh kargo vM.m.0 - ``` - * Verify the updated formula: - ```bash - brew install --build-from-source ./kargo.rb - kargo --version - ``` - * Commit and push the changes to the Homebrew tap repository: - ```bash - git add kargo.rb - git commit -m "Update Kargo formula to version vM.m.0" - git push origin main - ``` - 1. Mark the release branch (`release-M.m`) as the __"Production branch"__ [in Netlify](https://app.netlify.com/sites/docs-kargo-akuity-io/configuration/deploys#branches-and-deploy-contexts). From fbf5f02105a3f7b804d37ec544fbb359fa0137b4 Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Fri, 29 Nov 2024 21:16:10 +0530 Subject: [PATCH 04/10] fix configure-git step Signed-off-by: Faeka Ansari --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 74ede3f89..c7783ae9c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -355,9 +355,9 @@ jobs: - name: Configure Git and Commit changes run: | + cd homebrew-tap git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" - cd homebrew-tap git checkout -b update-kargo-${{ github.ref_name }} git add kargo.rb git commit -m "chore: update Kargo cli to version ${{ github.ref_name }}" From f69ed79eccbd328baa81b8c7f65809542b9de8bc Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Tue, 3 Dec 2024 00:10:18 +0530 Subject: [PATCH 05/10] address reviews by @krancour Signed-off-by: Faeka Ansari --- .github/workflows/release.yaml | 55 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c7783ae9c..0f9e72786 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -341,34 +341,33 @@ jobs: runs-on: ubuntu-latest needs: [ publish-image, publish-cli ] steps: - - name: Checkout bottle Repository - uses: actions/checkout@v4 - with: - repository: akuity/homebrew-tap - token: ${{ secrets.GITHUB_TOKEN }} - path: homebrew-tap + - name: Checkout tap repository + uses: actions/checkout@v4 + with: + repository: akuity/homebrew-tap + token: ${{ secrets.GITHUB_TOKEN }} - - name: Update Homebrew formula - run: | - cd homebrew-tap - ./update.sh kargo ${{ github.ref_name }} + - name: Setup Git User + uses: fregante/setup-git-user@v2 + with: + name: ${{ github.actor }} + email: ${{ github.actor }}@users.noreply.github.com - - name: Configure Git and Commit changes - run: | - cd homebrew-tap - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - git checkout -b update-kargo-${{ github.ref_name }} - git add kargo.rb - git commit -m "chore: update Kargo cli to version ${{ github.ref_name }}" + - name: Update formula and push + run: | + git checkout -b update-kargo-${{ github.ref_name }} + ./update.sh kargo ${{ github.ref_name }} + git add kargo.rb + git commit -m "chore: update Kargo cli to version ${{ github.ref_name }}" + git push origin update-kargo-${{ github.ref_name }} - - name: Push changes and open PR - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Update Kargo formula to version ${{ github.ref_name }}" - branch: update-kargo-${{ github.ref_name }} - base: main - title: "chore: update Kargo formula to version ${{ github.ref_name }}" - body: "This PR updates the Homebrew formula for Kargo to version ${{ github.ref_name }}." - delete-branch: 'true' + - name: Open PR + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update Kargo formula to version ${{ github.ref_name }}" + branch: update-kargo-${{ github.ref_name }} + base: main + title: "chore: update Kargo formula to version ${{ github.ref_name }}" + body: "This PR updates the Homebrew formula for Kargo to version ${{ github.ref_name }}." + delete-branch: 'true' From 583fda7135708a70e0a01f4edff756199a83b201 Mon Sep 17 00:00:00 2001 From: Kent Rancourt Date: Mon, 2 Dec 2024 20:51:09 -0500 Subject: [PATCH 06/10] Update .github/workflows/release.yaml Signed-off-by: Kent Rancourt --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0f9e72786..e65a0a2a4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -333,6 +333,7 @@ jobs: base64-subjects: "${{ needs.combine_hashes.outputs.hashes }}" upload-assets: true # Optional: Upload to a new release provenance-name: kargo-cli.intoto.jsonl + update-homebrew-formula: if: github.event_name == 'release' permissions: From 03897db88b8781bd1d4d92daba0fbee70dfaa206 Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Wed, 4 Dec 2024 07:42:11 +0530 Subject: [PATCH 07/10] update token names Signed-off-by: Faeka Ansari --- .github/workflows/release.yaml | 9 +++------ Makefile | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e65a0a2a4..de7d74751 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -335,10 +335,7 @@ jobs: provenance-name: kargo-cli.intoto.jsonl update-homebrew-formula: - if: github.event_name == 'release' - permissions: - contents: write # Needed to push changes - pull-requests: write # Needed to create a pull request + if: github.event_name == 'release' && github.event.action == 'released' # Runs only for stable releases runs-on: ubuntu-latest needs: [ publish-image, publish-cli ] steps: @@ -346,7 +343,7 @@ jobs: uses: actions/checkout@v4 with: repository: akuity/homebrew-tap - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.TAP_PAT }} - name: Setup Git User uses: fregante/setup-git-user@v2 @@ -365,7 +362,7 @@ jobs: - name: Open PR uses: peter-evans/create-pull-request@v5 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.TAP_PAT }} commit-message: "Update Kargo formula to version ${{ github.ref_name }}" branch: update-kargo-${{ github.ref_name }} base: main diff --git a/Makefile b/Makefile index 84258f16d..893101a5f 100644 --- a/Makefile +++ b/Makefile @@ -155,7 +155,7 @@ build-cli: ./cmd/cli ################################################################################ -# Used for Nighty/Unstable builds # +# Used for Nightly/Unstable builds # ################################################################################ .PHONY: build-nightly-cli From 57c4aa5b5ebcff2868f512aca4192a5fa8e6207e Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Thu, 5 Dec 2024 21:55:21 +0530 Subject: [PATCH 08/10] support versioned formula: works for latest and old patch releases (not minor release) Signed-off-by: Faeka Ansari --- .github/workflows/release.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index de7d74751..aecb78fe6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -353,8 +353,11 @@ jobs: - name: Update formula and push run: | + VERSION_SUFFIX=$(echo "${{ github.ref_name }}" | grep -oP "^v\d+\.\d+" | sed 's/^v/@/') + echo "version_suffix=$VERSION_SUFFIX" >> $GITHUB_ENV + git checkout -b update-kargo-${{ github.ref_name }} - ./update.sh kargo ${{ github.ref_name }} + ./update.sh kargo ${{ github.ref_name }} ${{ env.version_suffix }} git add kargo.rb git commit -m "chore: update Kargo cli to version ${{ github.ref_name }}" git push origin update-kargo-${{ github.ref_name }} From a2a66592fce573e7fac533ae2f1d94dfb147fa51 Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Fri, 6 Dec 2024 12:48:47 +0530 Subject: [PATCH 09/10] nit: adjust git configure step Signed-off-by: Faeka Ansari --- .github/workflows/release.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index aecb78fe6..6615dace1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -347,9 +347,6 @@ jobs: - name: Setup Git User uses: fregante/setup-git-user@v2 - with: - name: ${{ github.actor }} - email: ${{ github.actor }}@users.noreply.github.com - name: Update formula and push run: | From ea3c16e95c8ce3a42746384f7c6307b1144ae6f2 Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Fri, 6 Dec 2024 14:24:46 +0530 Subject: [PATCH 10/10] support versioned formula: works for latest patch, old patch and minor releases Signed-off-by: Faeka Ansari --- .github/workflows/release.yaml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6615dace1..5f5567df8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -345,17 +345,33 @@ jobs: repository: akuity/homebrew-tap token: ${{ secrets.TAP_PAT }} + - name: Export LATEST_TAG and VERSION_SUFFIX + run: | + LATEST_TAG=$(curl -qsSL \ + -H 'Accept: application/vnd.github+json' \ + -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + -H 'X-GitHub-Api-Version: 2022-11-28' \ + '${{ github.api_url }}/repos/${{ github.repository }}/releases/latest' \ + | jq -r .tag_name) + echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV + + VERSION_SUFFIX=$(echo "${{ github.ref_name }}" | grep -oP "^v\d+\.\d+" | sed 's/^v/@/') + echo "VERSION_SUFFIX=$VERSION_SUFFIX" >> $GITHUB_ENV + - name: Setup Git User uses: fregante/setup-git-user@v2 - - name: Update formula and push + - name: Update formula and push changes run: | - VERSION_SUFFIX=$(echo "${{ github.ref_name }}" | grep -oP "^v\d+\.\d+" | sed 's/^v/@/') - echo "version_suffix=$VERSION_SUFFIX" >> $GITHUB_ENV - git checkout -b update-kargo-${{ github.ref_name }} - ./update.sh kargo ${{ github.ref_name }} ${{ env.version_suffix }} - git add kargo.rb + + if [[ ${{ github.ref_name }} == ${{ env.LATEST_TAG }} ]]; then + ./update.sh kargo ${{ github.ref_name }} + git add kargo.rb + fi + + ./update.sh kargo ${{ github.ref_name }} ${{ env.VERSION_SUFFIX }} + git add kargo${{ env.VERSION_SUFFIX }}.rb git commit -m "chore: update Kargo cli to version ${{ github.ref_name }}" git push origin update-kargo-${{ github.ref_name }}