indicate dev build

This commit is contained in:
Kamil
2024-11-24 22:10:03 +00:00
parent 7de92f01ec
commit a84ae01e55
3 changed files with 22 additions and 4 deletions

View File

@@ -24,6 +24,18 @@ jobs:
version=$(python3 -c "import version; print(f'dev-{version.__version__}')") version=$(python3 -c "import version; print(f'dev-{version.__version__}')")
echo "VERSION=$version" >> $GITHUB_ENV echo "VERSION=$version" >> $GITHUB_ENV
# Extract branch name and latest commit SHA
- name: Extract branch name and commit SHA
id: branch_info
run: |
echo "BRANCH_NAME=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# Create a file indicating this is a dev build
- name: Create DEV_BUILD file
run: |
echo "${{ env.BRANCH_NAME }}-${{ env.COMMIT_SHA }}" > DEV_BUILD
# Set up Docker # Set up Docker
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2

View File

@@ -139,13 +139,19 @@ app.config.update(
result_backend=app.config['REDIS_URL'] result_backend=app.config['REDIS_URL']
) )
def read_dev_build_file(file_path="/jellyplist/DEV_BUILD"):
if os.path.exists(file_path):
with open(file_path, "r") as file:
content = file.read().strip()
return f"-{content}"
else:
return None
app.logger.info(f"initializing celery") app.logger.info(f"initializing celery")
celery = make_celery(app) celery = make_celery(app)
socketio = SocketIO(app, message_queue=app.config['REDIS_URL'], async_mode='eventlet') socketio = SocketIO(app, message_queue=app.config['REDIS_URL'], async_mode='eventlet')
celery.set_default() celery.set_default()
app.logger.info(f'Jellyplist {__version__} started') app.logger.info(f'Jellyplist {__version__}{read_dev_build_file()} started')
from app import routes from app import routes
from app import jellyfin_routes, tasks from app import jellyfin_routes, tasks
if "worker" in sys.argv: if "worker" in sys.argv:

View File

@@ -1,5 +1,5 @@
from flask import Flask, Response, jsonify, render_template, request, redirect, url_for, session, flash from flask import Flask, Response, jsonify, render_template, request, redirect, url_for, session, flash
from app import app, db, functions, sp, jellyfin, celery, jellyfin_admin_token, jellyfin_admin_id,device_id, cache from app import app, db, functions, sp, jellyfin, celery, jellyfin_admin_token, jellyfin_admin_id,device_id, cache, read_dev_build_file
from app.models import JellyfinUser,Playlist,Track from app.models import JellyfinUser,Playlist,Track
from celery.result import AsyncResult from celery.result import AsyncResult
from .version import __version__ from .version import __version__
@@ -7,7 +7,7 @@ from .version import __version__
@app.context_processor @app.context_processor
def add_context(): def add_context():
unlinked_track_count = len(Track.query.filter_by(downloaded=True,jellyfin_id=None).all()) unlinked_track_count = len(Track.query.filter_by(downloaded=True,jellyfin_id=None).all())
version = f"v{__version__}" version = f"v{__version__}{read_dev_build_file()}"
return dict(unlinked_track_count = unlinked_track_count, version = version) return dict(unlinked_track_count = unlinked_track_count, version = version)
@app.after_request @app.after_request