ci: build pull requests from branches that release

- a push that changes release.json stays unbuilt, the release workflow builds it
This commit is contained in:
peaklabs-dev
2026-11-01 19:37:42 +01:00
parent 4c78b72e9b
commit 7d1970a8c7
2 changed files with 30 additions and 2 deletions
+29 -1
View File
@@ -16,9 +16,37 @@ defaults:
shell: bash
jobs:
detect:
name: Detect release push
permissions:
contents: read
runs-on: ubuntu-26.04 # https://github.com/actions/runner-images
timeout-minutes: 10
outputs:
release: ${{ steps.detect.outputs.release }}
steps:
- name: Check whether the push releases
id: detect
env:
GH_TOKEN: ${{ github.token }}
ACTION: ${{ github.event.action }}
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
HEAD_BRANCH: ${{ github.head_ref }}
BEFORE: ${{ github.event.before }}
AFTER: ${{ github.event.after }}
run: |
release=false
if [ "$ACTION" = synchronize ] && [ "$HEAD_REPOSITORY" = "$GITHUB_REPOSITORY" ] \
&& [[ "$HEAD_BRANCH" =~ ^(main|next|v[0-9]+(\.[0-9]+)?\.x|release/v[0-9]+\.[0-9]+)$ ]]; then
files="$(gh api "repos/$GITHUB_REPOSITORY/compare/$BEFORE...$AFTER" --jq '.files[].filename')"
! grep -qxE 'release\.json' <<< "$files" || release=true
fi
echo "release=$release" | tee -a "$GITHUB_OUTPUT"
build:
name: Build
if: ${{ github.event.pull_request.head.repo.full_name != github.repository || !(github.head_ref == 'main' || github.head_ref == 'next' || startsWith(github.head_ref, 'release/') || endsWith(github.head_ref, '.x')) }}
needs: detect
if: ${{ needs.detect.outputs.release == 'false' }}
permissions:
contents: read
uses: $/.github/workflows/build.yaml
+1 -1
View File
@@ -151,7 +151,7 @@ Print what the next run builds with `scripts/plan-version.sh --main`.
Every push to a pull request from a branch of this repository publishes `ghcr.io/coollabsio/coolify:pr-<number>`, versioned `<version of the base branch>-pr.<number>`. Pull request 1234 into `next` is `pr-1234` with the version `4.6.0-beta.1-pr.1234`, which sorts after `4.6.0-beta.1` and its nightlies and before `4.6.0-beta.2`.
- Pull requests from forks and Dependabot are built, not published
- Pull requests from `main`, `next`, a release branch or a patch branch are not built, the release, nightly and main workflows build their commits
- A push to a pull request from `main`, `next`, a release branch or a patch branch that changes `release.json` is not built, the release workflow builds it
- Pull request builds are published to ghcr.io only, as the Docker Hub credentials are in the `release` environment, which no pull request run can use
- Pull request builds create no git tag and no GitHub release