ci: publish an image for every pull request

- version.sh --build appends the -pr.<number> suffix
This commit is contained in:
peaklabs-dev
2026-11-01 19:37:39 +01:00
parent 49590cf959
commit 2615559b5e
4 changed files with 64 additions and 1 deletions
+1
View File
@@ -35,6 +35,7 @@ jobs:
- id: version
env:
BRANCH: ${{ github.base_ref || github.ref_name }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
run: |
coolify="$(scripts/version.sh --build)"
echo "coolify=$coolify" >> "$GITHUB_OUTPUT"
+53
View File
@@ -0,0 +1,53 @@
name: Pull request
on:
pull_request:
permissions: {}
cache-mode: none
concurrency:
group: pull-request-${{ github.event.pull_request.number }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build:
name: Build
permissions:
contents: read
uses: $/.github/workflows/build.yaml
publish:
name: Publish pr-${{ github.event.pull_request.number }}
needs: build
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
permissions:
packages: write # push the image of the pull request to ghcr.io
runs-on: ubuntu-26.04 # https://github.com/actions/runner-images
timeout-minutes: 30
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # https://github.com/actions/download-artifact/releases/tag/v8.0.2
with:
pattern: image-*
path: ${{ runner.temp }}/images
- uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # https://github.com/docker/login-action/releases/tag/v4.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push the image of the pull request
env:
TAG: pr-${{ github.event.pull_request.number }}
run: |
sources=()
for index in "$RUNNER_TEMP"/images/*/index.json; do
sources+=("oci-layout://${index%/index.json}@$(jq -r '.manifests[0].digest' "$index")")
done
docker buildx imagetools create --tag "ghcr.io/coollabsio/coolify:$TAG" "${sources[@]}"