Build package(s) on upstream release (#24)

This commit is contained in:
Bethuel Mmbaga
2025-12-29 12:22:59 +03:00
committed by GitHub
parent ef5220a908
commit d01c00c217
2 changed files with 90 additions and 0 deletions
+34
View File
@@ -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*(?<currentValue>\\d+\\.\\d+\\.\\d+)"
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "netbirdio/netbird",
"versioningTemplate": "semver",
"extractVersionTemplate": "^v(?<version>.*)$"
}
],
"packageRules": [
{
"matchDatasources": ["github-releases"],
"matchDepNames": ["netbirdio/netbird"],
"commitMessageTopic": "NetBird client",
"commitMessageExtra": "to {{newVersion}}",
"prTitle": "Update NetBird client to {{newVersion}}",
"automergeType": "pr"
}
]
}
+56
View File
@@ -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.`
})