Make release/1.x a privileged branch to run workflows, create releases

It'll work similar to the master branch but with pre-1x and latest-1x
tagged series of docker images.

This should ease deployment changes from 1.x vs 2.x series
This commit is contained in:
Debanjum
2025-07-04 00:45:30 -07:00
parent 2daf396cbb
commit 58f44ad43b
8 changed files with 37 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ on:
- "*"
branches:
- master
- release/1.x
paths:
- src/khoj/**
- src/interface/web/**
@@ -37,8 +38,8 @@ env:
# Tag Image with tag name on release
# else with user specified tag (default 'dev') if triggered via workflow
# else with run_id if triggered via a pull request
# else with 'pre' (if push to master)
DOCKER_IMAGE_TAG: ${{ github.ref_type == 'tag' && github.ref_name || github.event_name == 'workflow_dispatch' && github.event.inputs.tag || 'pre' }}
# else with 'pre' (if push to master) or 'pre-1x' (if push to release/1.x)
DOCKER_IMAGE_TAG: ${{ github.ref_type == 'tag' && github.ref_name || github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name == 'release/1.x' && 'pre-1x' || 'pre' }}
jobs:
build:
@@ -153,18 +154,32 @@ jobs:
- name: Create and Push Local Manifest
if: github.event.inputs.khoj == 'true' || github.event_name == 'push'
run: |
# Only put "latest.*" tag on stable releases (i.e 1.x, 2.x+)
if [[ "${{ env.DOCKER_IMAGE_TAG }}" =~ ^[1-9]\.[0-9]+\.[0-9]+$ ]]; then
LATEST_TAG="latest"
else
LATEST_TAG="${{ env.DOCKER_IMAGE_TAG }}"
fi
docker buildx imagetools create \
-t ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }} \
-t ghcr.io/${{ github.repository }}:${{ github.ref_type == 'tag' && 'latest' || env.DOCKER_IMAGE_TAG }} \
-t ghcr.io/${{ github.repository }}:${LATEST_TAG} \
ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}-amd64 \
ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}-arm64
- name: Create and Push Cloud Manifest
if: github.event.inputs.khoj-cloud == 'true' || github.event_name == 'push'
run: |
# Only put "latest.*" tag on stable releases (i.e 1.x, 2.x+)
if [[ "${{ env.DOCKER_IMAGE_TAG }}" =~ ^[1-9]\.[0-9]+\.[0-9]+$ ]]; then
LATEST_TAG="latest"
else
LATEST_TAG="${{ env.DOCKER_IMAGE_TAG }}"
fi
docker buildx imagetools create \
-t ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }} \
-t ghcr.io/${{ github.repository }}-cloud:${{ github.ref_type == 'tag' && 'latest' || env.DOCKER_IMAGE_TAG }} \
-t ghcr.io/${{ github.repository }}-cloud:${LATEST_TAG} \
ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}-amd64 \
ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}-arm64