From 6d9d6478f812b2f9a130529b977b40c16dcaeae6 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 1 Dec 2026 11:40:25 +0100 Subject: [PATCH 1/2] ci: skip unneeded builds and update the trigger file from endoflife.date Co-Authored-By: Claude Opus 5.5 --- .github/build-skip-paths | 7 ++++ .github/workflows/build-pr.yml | 44 ++++++++++++++++++++ .github/workflows/build-push.yml | 41 +++++++++++++++++++ .github/workflows/build.yml | 66 ++++++++++++++---------------- .github/workflows/trigger-file.yml | 61 +++++++++++++++++++++++++++ .github/zizmor.yml | 4 ++ builder.json | 3 +- 7 files changed, 190 insertions(+), 36 deletions(-) create mode 100644 .github/build-skip-paths create mode 100644 .github/workflows/build-pr.yml create mode 100644 .github/workflows/build-push.yml create mode 100644 .github/workflows/trigger-file.yml create mode 100644 .github/zizmor.yml diff --git a/.github/build-skip-paths b/.github/build-skip-paths new file mode 100644 index 00000000..118962c4 --- /dev/null +++ b/.github/build-skip-paths @@ -0,0 +1,7 @@ +^renovate\.Dockerfile$ +\.md$ +^LICENSE$ +^\.editorconfig$ +^\.github/renovate\.json$ +^\.github/build-skip-paths$ +^\.github/zizmor\.yml$ diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 00000000..f574d18e --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,44 @@ +name: build-pr + +on: + pull_request: + types: + - opened + - synchronize + - reopened + # runs the build skipped for drafts + - ready_for_review + # cancels a running build + - converted_to_draft + # the `ci:skip-build` label skips or restores the build + - labeled + - unlabeled + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + uses: ./.github/workflows/build.yml + permissions: + contents: write + checks: write + pull-requests: read + + # required check + success: + needs: + - build + runs-on: ubuntu-slim + timeout-minutes: 1 + if: always() + steps: + - name: Fail for failed or cancelled build + if: | + needs.build.result == 'failure' || + needs.build.result == 'cancelled' + run: exit 1 diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml new file mode 100644 index 00000000..8992f926 --- /dev/null +++ b/.github/workflows/build-push.yml @@ -0,0 +1,41 @@ +name: build-push + +on: + push: + # other branches are built by their pull request + branches: + - main + merge_group: + schedule: + - cron: '0 1 * * *' + +# pushes and scheduled runs on `main` publish releases, so they queue instead of +# cancelling each other; each run builds all missing releases +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +permissions: + contents: read + +jobs: + build: + uses: ./.github/workflows/build.yml + permissions: + contents: write + checks: write + pull-requests: read + + # required check + success: + needs: + - build + runs-on: ubuntu-slim + timeout-minutes: 1 + if: always() + steps: + - name: Fail for failed or cancelled build + if: | + needs.build.result == 'failure' || + needs.build.result == 'cancelled' + run: exit 1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28cd8db6..023d54b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,24 +1,34 @@ name: build +# called by `build-pr.yml` and `build-push.yml`, which also hold the required +# `success` check on: - push: - branches: - - main + workflow_call: - pull_request: - merge_group: +# no workflow `permissions`: every job sets its own - schedule: - - cron: '0 1 * * *' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.ref }} - cancel-in-progress: true +jobs: + setup: + runs-on: ubuntu-slim + timeout-minutes: 5 + permissions: + contents: read + pull-requests: read # labels of the merge group pull requests + outputs: + skip-build: ${{ steps.changes.outputs.skip-build }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + show-progress: false -permissions: - contents: read + # pull requests and merge groups which only change the trigger file, docs + # or repo settings, or have the `ci:skip-build` label, skip the build; + # pushes and scheduled runs always build, see `.github/build-skip-paths` + - name: Check for changes that don't need the build + id: changes + uses: containerbase/internal-tools/changes@a6ed429d9fbf1112bb45a901e63d0d303a671db6 # v5.5.4 -jobs: lint: # the scheduled builds only pick up new releases, the code is already linted if: github.event_name != 'schedule' @@ -73,9 +83,14 @@ jobs: build: needs: + - setup - lint - # also run when lint was skipped on schedule - if: ${{ !cancelled() && !failure() }} + # also run when lint was skipped on schedule; skipped for draft pull + # requests and changes which don't need it, see `setup` + if: | + !cancelled() && !failure() && + github.event.pull_request.draft != true && + needs.setup.outputs.skip-build != 'true' runs-on: ${{ matrix.arch.os }} timeout-minutes: 60 name: build (${{ matrix.distro }}, ${{ matrix.arch.name }}) @@ -115,22 +130,3 @@ jobs: # noble only gets new releases config: ${{ matrix.distro == 'noble' && 'builder.noble.json' || 'builder.json' }} token: ${{ secrets.GITHUB_TOKEN }} - - success: - runs-on: ubuntu-slim - needs: - - lint - - build - timeout-minutes: 1 - if: always() - steps: - - name: Fail for failed or cancelled build - if: | - needs.build.result == 'failure' || - needs.build.result == 'cancelled' - run: exit 1 - - name: Fail for failed or cancelled lint - if: | - needs.lint.result == 'failure' || - needs.lint.result == 'cancelled' - run: exit 1 diff --git a/.github/workflows/trigger-file.yml b/.github/workflows/trigger-file.yml new file mode 100644 index 00000000..d35e65b0 --- /dev/null +++ b/.github/workflows/trigger-file.yml @@ -0,0 +1,61 @@ +name: trigger-file + +# keeps the release streams of `renovate.Dockerfile` in sync with +# endoflife.date: drops EOL streams and adds new ones, see `eol` in +# `builder.json` +on: + schedule: + - cron: '0 6 * * 1' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +permissions: {} + +jobs: + update: + runs-on: ubuntu-slim + timeout-minutes: 10 + permissions: + contents: read # the app token below pushes the branch + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + show-progress: false + + - name: Update the trigger file + id: trigger + uses: containerbase/internal-tools@a6ed429d9fbf1112bb45a901e63d0d303a671db6 # v5.5.4 + with: + command: trigger-file + + # pull requests created with `github.token` don't trigger workflows, so + # the pull request is created with an app token to run CI on it + - name: Create app token + if: steps.trigger.outputs.changed == 'true' + id: app-token + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 + with: + client-id: ${{ vars.BACKPORT_APP_CLIENT_ID }} + private-key: ${{ secrets.BACKPORT_APP_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write + + # the trigger file needs no test build, the push to `main` builds the + # new streams + - name: Create pull request + if: steps.trigger.outputs.changed == 'true' + uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3 + with: + token: ${{ steps.app-token.outputs.token }} + branch: chore/trigger-file + delete-branch: true + commit-message: 'chore: update the release streams of the trigger file' + title: 'chore: update the release streams of the trigger file' + body: ${{ steps.trigger.outputs.summary }} + labels: ci:skip-build + reviewers: viceice + add-paths: renovate.Dockerfile diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 00000000..4cc77647 --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,4 @@ +rules: + # the reusable workflow is referenced with `./`, like in the other containerbase repos + self-repository: + disable: true diff --git a/builder.json b/builder.json index 4b07a5dc..194719a4 100644 --- a/builder.json +++ b/builder.json @@ -5,5 +5,6 @@ "versioning": "ruby", "startVersion": "3.1.0", "ignoredVersions": [], - "reverse": true + "reverse": true, + "eol": { "product": "ruby", "stream": "minor" } } From a4a1d494dd369d55714e12d74c6109e0caf699ca Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 1 Dec 2026 13:52:58 +0100 Subject: [PATCH 2/2] docs: point the build badge at the build-push workflow Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aae8e920..11637fc1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # containerbase Ruby releases -[![build](https://github.com/containerbase/ruby-prebuild/actions/workflows/build.yml/badge.svg)](https://github.com/containerbase/ruby-prebuild/actions/workflows/build.yml?query=branch%3Amain) +[![build](https://github.com/containerbase/ruby-prebuild/actions/workflows/build-push.yml/badge.svg?branch=main)](https://github.com/containerbase/ruby-prebuild/actions/workflows/build-push.yml?query=branch%3Amain) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/containerbase/ruby-prebuild) ![License: MIT](https://img.shields.io/github/license/containerbase/ruby-prebuild)