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 <info@vshn.ch>", "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/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 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 3b6a5d1..4cb6749 100644 --- a/renovate.json +++ b/renovate.json @@ -7,35 +7,62 @@ "ignorePaths": [ ".github/**" ], + "labels": [ + "dependency" + ], + "separateMinorPatch": true, + "separateMultipleMajor": true, "postUpgradeTasks": { "commands": [ "make gen-golden-all" ], - "fileFilters": [ "tests/golden/**" ], + "fileFilters": [ + "tests/golden/**" + ], "executionMode": "update" }, - "suppressNotifications": [ "artifactErrors" ], - "labels": [ - "dependency" + "suppressNotifications": [ + "artifactErrors" ], - "separateMinorPatch": true, - "separateMultipleMajor": true, "packageRules": [ { - "matchUpdateTypes": ["major"], - "labels": ["dependency", "bump:major"] + "matchUpdateTypes": [ + "patch" + ], + "automerge": true, + "platformAutomerge": false, + "labels": [ + "dependency", + "automerge", + "bump:patch" + ] }, { - "matchUpdateTypes": ["minor"], - "labels": ["dependency", "bump:minor"], + "matchUpdateTypes": [ + "minor" + ], "automerge": true, - "platformAutomerge": true + "platformAutomerge": false, + "labels": [ + "dependency", + "automerge", + "bump:minor" + ], + "matchPackagePatterns": [ + ".*" + ] }, { - "matchUpdateTypes": ["patch"], - "labels": ["dependency", "bump:patch"], + "matchUpdateTypes": [ + "major" + ], "automerge": true, - "platformAutomerge": true + "platformAutomerge": false, + "labels": [ + "dependency", + "automerge", + "bump:major" + ] } ] }