From 547e59b2ad7b866faf73712f85100b4dada9c948 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 30 Jul 2026 14:45:11 +0200 Subject: [PATCH] .github: allow building and releasing from maintenance branches With 5.0 on master, maintenance releases move to a 4.x branch: run push builds, docs deploy, and weekly distcheck for any N.x branch, and mark only the highest stable tag as the latest release. Signed-off-by: Joachim Wiberg --- .github/workflows/build.yml | 11 +++++------ .github/workflows/docs.yml | 2 +- .github/workflows/release.yml | 9 +++++++-- .github/workflows/weekly.yml | 31 +++++++++++++++++++++---------- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 460d378a..434afd41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,13 @@ name: Bob the Builder -# Run on all branches, including all pull requests, except the 'dev' -# branch since that's where we run Coverity Scan (limited tokens/day) +# Run on push to release branches (master and maintenance N.x), and +# on all pull requests. The 'dev' branch is where we run Coverity +# Scan (limited tokens/day) on: push: branches: - - '**' - - '!dev' + - master + - '[0-9]+.x' pull_request: types: [opened, synchronize, reopened, labeled] @@ -22,8 +23,6 @@ jobs: # Verify we can build on latest Ubuntu with both gcc and clang name: ${{ matrix.compiler }} runs-on: ubuntu-latest - # Skip redundant builds for PRs - prefer PR builds over push builds - if: github.event_name != 'push' || github.ref == 'refs/heads/master' strategy: matrix: compiler: [gcc, clang] diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 28e98055..e8f5e233 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,7 +4,7 @@ on: push: branches: - master - - 4.x + - '[0-9]+.x' paths: - 'doc/**' - 'README.md' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f740e24..27fe8331 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,12 +31,17 @@ jobs: run: | ver=${GITHUB_REF#refs/tags/} echo "ver=${ver}" >> $GITHUB_OUTPUT - if echo $ver | grep -qE '^[0-9]+\.[0-9]+(\.[0-9]+)?(-alpha|-beta|-rc)[0-9]*$'; then + stable='[0-9]+\.[0-9]+(\.[0-9]+)?' + if echo $ver | grep -qE "^${stable}(-alpha|-beta|-rc)[0-9]*$"; then echo "pre=true" >> $GITHUB_OUTPUT else echo "pre=false" >> $GITHUB_OUTPUT fi - if echo $ver | grep -qE '^[0-9.]+\.[0-9.]+(\.[0-9]+)?$'; then + # Mark as latest release only if this is the highest stable + # tag, so a 4.x maintenance release doesn't outrank 5.x + newest=$(git ls-remote --tags --refs origin | awk -F/ '{print $NF}' \ + | grep -E "^${stable}$" | sort -V | tail -1) + if [ "$ver" = "$newest" ]; then echo "latest=true" >> $GITHUB_OUTPUT else echo "latest=false" >> $GITHUB_OUTPUT diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 56991c2f..bc2b102a 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -14,22 +14,31 @@ jobs: schedule: runs-on: ubuntu-latest outputs: - run: ${{ steps.schedule.outputs.run }} + branches: ${{ steps.schedule.outputs.branches }} steps: - uses: actions/checkout@v4 - - name: Check for any commits since last week + with: + fetch-depth: 0 + - name: Check for branches with no commits since last week id: schedule run: | - commits="$(git log --format=%H --since='1 week ago')" - if [ -z "$commits" ]; then - echo "run=true" >> $GITHUB_OUTPUT - else - echo "run=false" >> $GITHUB_OUTPUT - fi + branches= + maint=$(git branch -r --format='%(refname:lstrip=3)' | grep -E '^[0-9]+\.x$') + for branch in master $maint; do + commits="$(git log --format=%H --since='1 week ago' origin/$branch)" + if [ -z "$commits" ]; then + branches="$branches\"$branch\"," + fi + done + echo "branches=[${branches%,}]" >> $GITHUB_OUTPUT distcheck: needs: schedule - if: ${{ needs.schedule.outputs.run == 'true' }} + if: ${{ needs.schedule.outputs.branches != '[]' }} runs-on: ubuntu-latest + strategy: + matrix: + branch: ${{ fromJSON(needs.schedule.outputs.branches) }} + fail-fast: false steps: - name: Install dependencies run: | @@ -43,6 +52,8 @@ jobs: (cd libite-2.6.2 && ./configure && make -j9 && sudo make install-strip) sudo ldconfig - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} - name: Base run run: | ./autogen.sh @@ -63,5 +74,5 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: finit-weekly-test-logs + name: finit-weekly-test-logs-${{ matrix.branch }} path: finit-*/_build/sub/test/*.log