From 4af26ad6351dde49d4c7f2cc0aab0fc564ff9fa5 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Fri, 14 Jun 2024 13:15:26 +0200 Subject: [PATCH 1/4] Remove custom `renovate.json` automerge config --- renovate.json | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/renovate.json b/renovate.json index 3b6a5d1..e174b12 100644 --- a/renovate.json +++ b/renovate.json @@ -18,24 +18,5 @@ "labels": [ "dependency" ], - "separateMinorPatch": true, - "separateMultipleMajor": true, - "packageRules": [ - { - "matchUpdateTypes": ["major"], - "labels": ["dependency", "bump:major"] - }, - { - "matchUpdateTypes": ["minor"], - "labels": ["dependency", "bump:minor"], - "automerge": true, - "platformAutomerge": true - }, - { - "matchUpdateTypes": ["patch"], - "labels": ["dependency", "bump:patch"], - "automerge": true, - "platformAutomerge": true - } - ] + "separateMinorPatch": true } From a64ed078c80e41c42b2e8b3053fef7416ddefda9 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Fri, 14 Jun 2024 13:18:08 +0200 Subject: [PATCH 2/4] Update from template Template version: main (ea12eff) --- .cruft.json | 8 +++++- .github/workflows/auto-release.yaml | 18 ++++++++++++ .github/workflows/release.yaml | 1 + renovate.json | 43 +++++++++++++++++++++++++---- 4 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/auto-release.yaml diff --git a/.cruft.json b/.cruft.json index 6dfb730..ee6f65d 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/projectsyn/commodore-component-template.git", - "commit": "7803d07f1d79fc8b902fcafbb336b6b0a4b57b90", + "commit": "ea12efff947bce80cf31a3f1ed4412eab40e8b33", "checkout": "main", "context": { "cookiecutter": { @@ -13,6 +13,12 @@ "add_golden": "y", "add_matrix": "y", "add_go_unit": "n", + "automerge_patch": "y", + "automerge_patch_v0": "y", + "automerge_patch_regexp_blocklist": "", + "automerge_patch_v0_regexp_allowlist": "", + "automerge_minor_regexp_allowlist": ".*", + "auto_release": "y", "copyright_holder": "VSHN AG ", "copyright_year": "2021", "github_owner": "appuio", diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 0000000..b6bf69c --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,18 @@ +name: Autorelease +on: + pull_request: + types: + - synchronize + - labeled + - unlabeled + - closed + +jobs: + create-release-tag: + runs-on: ubuntu-latest + steps: + - name: Create new tag + uses: projectsyn/pr-label-tag-action@v1 + with: + trigger: | + Release diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 36c0ef8..7119ee3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,6 +3,7 @@ on: push: tags: - v* + workflow_dispatch: jobs: build: diff --git a/renovate.json b/renovate.json index e174b12..3e2c8cb 100644 --- a/renovate.json +++ b/renovate.json @@ -7,16 +7,49 @@ "ignorePaths": [ ".github/**" ], + "labels": [ + "dependency" + ], + "separateMinorPatch": true, "postUpgradeTasks": { "commands": [ "make gen-golden-all" ], - "fileFilters": [ "tests/golden/**" ], + "fileFilters": [ + "tests/golden/**" + ], "executionMode": "update" }, - "suppressNotifications": [ "artifactErrors" ], - "labels": [ - "dependency" + "suppressNotifications": [ + "artifactErrors" ], - "separateMinorPatch": true + "packageRules": [ + { + "matchUpdateTypes": [ + "patch" + ], + "automerge": true, + "platformAutomerge": false, + "labels": [ + "dependency", + "automerge", + "bump:patch" + ] + }, + { + "matchUpdateTypes": [ + "minor" + ], + "automerge": true, + "platformAutomerge": false, + "labels": [ + "dependency", + "automerge", + "bump:minor" + ], + "matchPackagePatterns": [ + ".*" + ] + } + ] } From 7922ea989a9e94c3a0e09984567af93c1ce6d552 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Fri, 14 Jun 2024 13:21:53 +0200 Subject: [PATCH 3/4] Re-enable major dependency automerge and autorelease --- renovate.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/renovate.json b/renovate.json index 3e2c8cb..4cb6749 100644 --- a/renovate.json +++ b/renovate.json @@ -11,6 +11,7 @@ "dependency" ], "separateMinorPatch": true, + "separateMultipleMajor": true, "postUpgradeTasks": { "commands": [ "make gen-golden-all" @@ -50,6 +51,18 @@ "matchPackagePatterns": [ ".*" ] + }, + { + "matchUpdateTypes": [ + "major" + ], + "automerge": true, + "platformAutomerge": false, + "labels": [ + "dependency", + "automerge", + "bump:major" + ] } ] } From c50bb0903157f46120e9ec8ead7488e690d83f5e Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Fri, 14 Jun 2024 13:22:09 +0200 Subject: [PATCH 4/4] Remove PoC auto-tagging workflow We now have the template-managed auto-release workflow which uses the pr-label-tag-action that's implemented based on the findings from the PoC workflow. --- .github/workflows/autotag.yaml | 123 --------------------------------- 1 file changed, 123 deletions(-) delete mode 100644 .github/workflows/autotag.yaml diff --git a/.github/workflows/autotag.yaml b/.github/workflows/autotag.yaml deleted file mode 100644 index 8080bd5..0000000 --- a/.github/workflows/autotag.yaml +++ /dev/null @@ -1,123 +0,0 @@ -name: create tag -on: - pull_request: - # Run when PR head branch is updated (synchronize), when the set of PR - # labels is changed (labeled, unlabeled), and after the PR is closed. We - # additionally check for `merged==true` in the event payload on `closed` - # before actually pushing the tag. - types: - - synchronize - - labeled - - unlabeled - - closed - -jobs: - parse-labels: - if: contains(join(github.event.pull_request.labels.*.name, ';'), 'bump:') - runs-on: ubuntu-latest - outputs: - label-count: ${{ steps.bump.outputs.label-count }} - bump: ${{ steps.bump.outputs.bump }} - steps: - - name: extract version bump from labels - id: bump - env: - LABELS: ${{ join(github.event.pull_request.labels.*.name, ';') }} - run: | - bump="" - label_count=0 - for lbl in $(echo $LABELS | tr ";" "\n"); do - if [[ "$lbl" == "bump:"* ]]; then - label_count=$(( $label_count + 1 )) - bump=${lbl/bump:}; - fi - done - echo "found ${label_count} bump labels" - echo "version bump: ${bump}" - echo "bump=${bump}" >> $GITHUB_OUTPUT - echo "label-count=${label_count}" >> $GITHUB_OUTPUT - - name: try to find existing comment - uses: peter-evans/find-comment@v2 - id: comment - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: '🛠️ _Auto release' - - name: add or update PR comment for too many labels - if: steps.bump.outputs.label-count > 1 - uses: peter-evans/create-or-update-comment@v3 - with: - comment-id: ${{ steps.comment.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body: | - Found ${{ steps.bump.outputs.label-count }} `bump:` labels, please make sure you only add one `bump:` label. - - 🛠️ _Auto release disabled_ - edit-mode: replace - tag: - needs: parse-labels - if: needs.parse-labels.outputs.label-count == 1 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - fetch-depth: "0" - - name: install semver - run: | - curl -LO https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver - chmod +x ./semver - - name: configure git user - run: | - git config --global user.name "$GITHUB_ACTOR" - git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: compute next version - id: next-version - env: - bump: ${{ needs.parse-labels.outputs.bump }} - run: | - echo "bumping to next ${bump} version" - curVer=$(git tag --sort=-v:refname | head -n1) - echo "current version: ${curVer}" - newVer="v$(./semver bump ${bump} $curVer)" - echo "new version: ${newVer}" - echo "next-version=${newVer}" >> $GITHUB_OUTPUT - - name: try to find existing comment - uses: peter-evans/find-comment@v2 - id: comment - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: '🛠️ _Auto release ' - - name: add or update comment on PR - uses: peter-evans/create-or-update-comment@v3 - if: github.event.action != 'closed' - with: - comment-id: ${{ steps.comment.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body: | - 🚀 Merging this PR will release `${{ steps.next-version.outputs.next-version }}` - - 🛠️ _Auto release enabled_ with label `bump:${{ needs.parse-labels.outputs.bump }}` - edit-mode: replace - - name: create tag - env: - newVer: ${{ steps.next-version.outputs.next-version }} - run: git tag -a -m "${newVer}" "${newVer}" - - name: push tag (for merged PRs) - if: github.event.action == 'closed' && github.event.pull_request.merged == true - env: - newVer: ${{ steps.next-version.outputs.next-version }} - run: | - git push origin "${newVer}" - - name: Update comment on merged PR - uses: peter-evans/create-or-update-comment@v3 - if: github.event.action == 'closed' && github.event.pull_request.merged == true - with: - comment-id: ${{ steps.comment.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body: | - 🚀 This PR has been released as [`${{ steps.next-version.outputs.next-version }}`](https://github.com/${{ github.repository }}/releases/tag/${{ steps.next-version.outputs.next-version }}) - - 🛠️ _Auto release enabled_ with label `bump:${{ needs.parse-labels.outputs.bump }}` - edit-mode: replace