Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/build-skip-paths
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
^renovate\.Dockerfile$
\.md$
^LICENSE$
^\.editorconfig$
^\.github/renovate\.json$
^\.github/build-skip-paths$
^\.github/zizmor\.yml$
44 changes: 44 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -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
66 changes: 31 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 }})
Expand Down Expand Up @@ -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
61 changes: 61 additions & 0 deletions .github/workflows/trigger-file.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .github/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rules:
# the reusable workflow is referenced with `./`, like in the other containerbase repos
self-repository:
disable: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
3 changes: 2 additions & 1 deletion builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"versioning": "ruby",
"startVersion": "3.1.0",
"ignoredVersions": [],
"reverse": true
"reverse": true,
"eol": { "product": "ruby", "stream": "minor" }
}
Loading