diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..1a47795 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ], + "baseBranches": ["main", "update-ci"], + "prConcurrentLimit": 5, + "prHourlyLimit": 0, + "labels": ["dependencies"], + "automerge": false, + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["^netbird/Makefile$"], + "matchStrings": [ + "DISTVERSION=\\s*(?\\d+\\.\\d+\\.\\d+)" + ], + "datasourceTemplate": "github-releases", + "depNameTemplate": "netbirdio/netbird", + "versioningTemplate": "semver", + "extractVersionTemplate": "^v(?.*)$" + } + ], + "packageRules": [ + { + "matchDatasources": ["github-releases"], + "matchDepNames": ["netbirdio/netbird"], + "commitMessageTopic": "NetBird client", + "commitMessageExtra": "to {{newVersion}}", + "prTitle": "Update NetBird client to {{newVersion}}", + "automergeType": "pr" + } + ] +} \ No newline at end of file diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 0000000..99d7412 --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,56 @@ +name: Auto Release + +on: + pull_request: + types: [closed] + branches: + - main + - update-ci # Allow testing on this branch + +jobs: + auto-tag: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'dependencies') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract NetBird version from Makefile + id: get_version + run: | + VERSION=$(grep "^DISTVERSION=" netbird/Makefile | sed 's/DISTVERSION=\s*//') + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "tag=v${VERSION}" >> $GITHUB_OUTPUT + + - name: Check if tag already exists + id: check_tag + run: | + if git rev-parse "refs/tags/${{ steps.get_version.outputs.tag }}" >/dev/null 2>&1; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + - name: Create and push tag + if: steps.check_tag.outputs.exists == 'false' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a ${{ steps.get_version.outputs.tag }} -m "Release ${{ steps.get_version.outputs.tag }}" + git push origin ${{ steps.get_version.outputs.tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Comment on PR + if: steps.check_tag.outputs.exists == 'false' + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `✅ Release tag \`${{ steps.get_version.outputs.tag }}\` has been created and will trigger the build workflow.` + }) \ No newline at end of file