Skip to content

Commit

Permalink
ci: enable renovate automerge (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjorge-graphops committed Sep 30, 2023
1 parent bbe4b46 commit 34cc773
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/renovate.json5
Expand Up @@ -43,7 +43,9 @@
"commitMessageAction": "update",
"commitMessageExtra": "dependencies",
"branchName": 'renovate/{{{replace "src/schemas/(.*)\.cue" "$1" packageFile}}}',
"prTitle": 'ci(deps): update {{{replace "src/schemas/(.*)\.cue" "$1" packageFile}}} dependencies'
"prTitle": 'ci(deps): update {{{replace "src/schemas/(.*)\.cue" "$1" packageFile}}} dependencies',
"automerge": true,
"ignoreTests": true
},

// **auto-genereated** section, don't edit manually
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/trigger-push.yaml
@@ -0,0 +1,67 @@

name: Tag on Renovate Commits (Canary)

on:
push:
branches:
- 'main'

jobs:
find-tags-to-release:
if: ${{ github.actor == 'graphops-renovate[bot]' }}
runs-on: ubuntu-latest
permissions:
contents: write # for creating tags
outputs:
release-tags: ${{ steps.list-release-tags.outputs.release-tags }}
steps:
- name: Checkout
uses: actions/checkout@v3
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 list of changed namespaces
id: list-changed-namespaces
uses: tj-actions/changed-files@v35.9.2
with:
files: ./**/helmfile.yaml
dir_names: "true"
dir_names_max_depth: "1"

- name: List and create tags
id: list-release-tags
shell: bash
run: |
tags=()
for namespace_name in ${{ steps.list-changed-namespaces.outputs.all_modified_files }}; do
latest_version="$(git -c 'versionsort.suffix=-' tag --sort 'version:refname' --list "$namespace_name-*" | grep -Ev '.*-[[:digit:]]+.[[:digit:]]+.[[:digit:]]+-.*' | tail -n1)"
next_patch="$(echo "$latest_version" | sed -E 's/(.*-)?v?([[:digit:]]+).([[:digit:]]+).([[:digit:]]+)/echo \2.\3.$((\4 + 1))/e')"
last_pre_tag="$(git -c 'versionsort.suffix=-' tag --sort 'version:refname' --list "$namespace_name-$next_patch-*" | tail -n1)"
if [ -z "$last_pre_tag" ]; then
index=1
else
index=$(echo "$last_pre_tag" | sed -E 's/(.*-)?v?[[:digit:]]+.[[:digit:]]+.[[:digit:]]+-canary.([[:digit:]]+)(#.*)?/echo $((\2 + 1))/e')
fi
next_tag="$namespace_name-$next_patch-canary.$index"
tags+=("$next_tag")
git tag -a "$next_tag" -m "Release $next_tag"
done
git push --tags
echo "release-tags<<EOF" >> $GITHUB_OUTPUT
echo "$(jq -Rc '. / " "' <<< ${tags[*]})" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
call-update-tags:
if: ${{ github.actor == 'graphops-renovate[bot]' }}
uses: ./.github/workflows/update-tags.yaml
permissions:
contents: write

0 comments on commit 34cc773

Please sign in to comment.