add QA image build for GCHR images

This commit is contained in:
Timothy Carambat 2026-02-10 09:12:21 -08:00
parent 1f93753058
commit 35b09325d1
2 changed files with 88 additions and 0 deletions

64
.github/workflows/build-qa-tag.yaml vendored Normal file
View File

@ -0,0 +1,64 @@
# Builds a QA GHCR image for a PR when the "PR: Ready for QA" label is present.
# Triggers on:
# - "PR: Ready for QA" label added to a PR
# - New commits pushed to a PR that already has the label will trigger a new build
name: Build QA GHCR Image
on:
pull_request:
types: [labeled, synchronize]
paths-ignore:
- "**.md"
- ".gitmodules"
- "cloud-deployments/**/*"
- "images/**/*"
- ".vscode/**/*"
- "**/.env.example"
- ".github/ISSUE_TEMPLATE/**/*"
- ".devcontainer/**/*"
- "embed/**/*"
- "browser-extension/**/*"
- "extras/**/*"
concurrency:
group: qa-build-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
name: Build and push QA image for PR
runs-on: ubuntu-22.04-arm
# Run when labeled with "PR: Ready for QA"
if: contains(github.event.pull_request.labels.*.name, 'PR: Ready for QA')
permissions:
packages: write
contents: read
pull-requests: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.22.0
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: true
sbom: true
provenance: mode=max
platforms: linux/arm64
tags: ghcr.io/${{ github.repository_owner }}/anythingllm:pr-${{ github.event.pull_request.number }}
cache-from: type=gha
cache-to: type=gha,mode=max

24
.github/workflows/cleanup-qa-tag.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
# Cleans up the GHCR image tag when the PR is closed or the "PR: Ready for QA" label is removed.
name: Cleanup QA Docker Image
on:
pull_request:
types: [closed, unlabeled]
jobs:
cleanup:
name: Delete QA image tag from GHCR
runs-on: ubuntu-latest
if: |
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR: Ready for QA')) ||
(github.event.action == 'unlabeled' && github.event.label.name == 'PR: Ready for QA')
permissions:
packages: write
steps:
- name: Delete PR tag from GHCR
uses: actions/delete-package-versions@v5
with:
package-name: anythingllm
package-type: container
min-versions-to-keep: 0
ignore-versions: '^(?!pr-${{ github.event.pull_request.number }}$).*$'