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,12 +6,14 @@ on:
push:
branches:
- 'master'
- 'release/1.x'
paths:
- src/interface/emacs/*.el
- .github/workflows/build_khoj_el.yml
pull_request:
branches:
- 'master'
- 'release/1.x'
paths:
- src/interface/emacs/*.el
- .github/workflows/build_khoj_el.yml

View File

@@ -6,6 +6,7 @@ on:
- "*"
branches:
- 'master'
- 'release/1.x'
paths:
- src/interface/desktop/**
- .github/workflows/desktop.yml

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

View File

@@ -2,6 +2,9 @@ name: pre-commit
on:
pull_request:
branches:
- master
- release/1.x
paths:
- src/**
- tests/**
@@ -12,6 +15,7 @@ on:
push:
branches:
- master
- release/1.x
paths:
- src/khoj/**
- tests/**

View File

@@ -6,6 +6,7 @@ on:
- "*"
branches:
- 'master'
- 'release/1.x'
paths:
- src/khoj/**
- src/interface/web/**
@@ -14,6 +15,7 @@ on:
pull_request:
branches:
- 'master'
- 'release/1.x'
paths:
- src/khoj/**
- src/interface/web/**
@@ -74,7 +76,7 @@ jobs:
path: dist/khoj-*.whl
- name: 📦 Publish Python Package to PyPI
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master'
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release/1.x'
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
skip-existing: true

View File

@@ -2,6 +2,9 @@ name: test
on:
pull_request:
branches:
- master
- release/1.x
paths:
- src/khoj/**
- tests/**
@@ -13,6 +16,7 @@ on:
push:
branches:
- master
- release/1.x
paths:
- src/khoj/**
- tests/**

View File

@@ -4,6 +4,7 @@ on:
push:
branches:
- 'master'
- 'release/1.x'
paths:
- src/interface/emacs/*.el
- src/interface/emacs/tests/*.el
@@ -11,6 +12,7 @@ on:
pull_request:
branches:
- 'master'
- 'release/1.x'
paths:
- src/interface/emacs/*.el
- src/interface/emacs/tests/*.el