From 7b01123159986e7a543f80277272362991ec2b7d Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Sat, 15 Nov 2025 12:58:38 +0100 Subject: [PATCH] some arrangements - removed search_index - initial POC for release creatiom - rearranged notes (temporarily) --- .github/workflows/docker-publish.yml | 82 ++++++++++++++++--- Dockerfile | 4 +- README.md | 9 +- backend/utils.py | 2 - config.yaml | 3 +- data/{notes => }/API.md | 0 data/{notes => }/AUTHENTICATION.md | 0 data/{notes => }/FEATURES.md | 0 data/{notes => }/MATHJAX.md | 0 data/{notes => }/PLUGINS.md | 0 ...tatistics.md => PLUGIN_NOTE_STATISTICS.md} | 0 data/{notes => }/THEMES.md | 0 docker-compose.ghcr.yml | 2 +- docker-compose.yml | 2 +- run.py | 5 +- 15 files changed, 82 insertions(+), 27 deletions(-) rename data/{notes => }/API.md (100%) rename data/{notes => }/AUTHENTICATION.md (100%) rename data/{notes => }/FEATURES.md (100%) rename data/{notes => }/MATHJAX.md (100%) rename data/{notes => }/PLUGINS.md (100%) rename data/{notes/PLUGINS/Note Statistics.md => PLUGIN_NOTE_STATISTICS.md} (100%) rename data/{notes => }/THEMES.md (100%) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index d212b03..08e82ac 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,12 +1,6 @@ name: Build and Push Docker Image to GHCR on: - pull_request: - types: - - closed - branches: - - main - - master push: tags: - 'v*.*.*' @@ -18,19 +12,16 @@ env: jobs: build-and-push: - # Only run if PR was merged (not just closed) or if triggered by tag/manual - if: | - (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || - github.event_name == 'push' || - github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest permissions: - contents: read + contents: write packages: write steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for release notes - name: Set up QEMU for multi-architecture builds uses: docker/setup-qemu-action@v3 @@ -73,3 +64,70 @@ jobs: - name: Image digest run: echo "Image pushed with digest ${{ steps.build-push.outputs.digest }}" + - name: Generate release notes + id: release_notes + run: | + # Get the previous tag + PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") + + # Generate commit log - extract PR descriptions from merge commits + if [ -z "$PREVIOUS_TAG" ]; then + # First release, get only merge commits (PR merges) + RAW_COMMITS=$(git log --merges --pretty=format:"%s|||%b|||%h" --first-parent) + else + # Get merge commits since last tag + RAW_COMMITS=$(git log ${PREVIOUS_TAG}..HEAD --merges --pretty=format:"%s|||%b|||%h" --first-parent) + fi + + # Process commits to extract meaningful messages + COMMITS="" + while IFS= read -r line; do + if [ -n "$line" ]; then + SUBJECT=$(echo "$line" | cut -d'|' -f1) + BODY=$(echo "$line" | cut -d'|' -f4 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') + HASH=$(echo "$line" | cut -d'|' -f7) + + # If body exists and is not empty, use it; otherwise use subject + if [ -n "$BODY" ] && [ "$BODY" != "" ]; then + # Capitalize first letter of body + MESSAGE=$(echo "$BODY" | sed 's/^./\U&/') + COMMITS="${COMMITS}- ${MESSAGE} (${HASH})"$'\n' + else + COMMITS="${COMMITS}- ${SUBJECT} (${HASH})"$'\n' + fi + fi + done <<< "$RAW_COMMITS" + + # Create release notes + echo "## What's Changed" > release_notes.md + echo "" >> release_notes.md + if [ -z "$COMMITS" ]; then + echo "- Minor updates and improvements" >> release_notes.md + else + echo "$COMMITS" >> release_notes.md + fi + echo "" >> release_notes.md + echo "## Docker Images" >> release_notes.md + echo "" >> release_notes.md + echo "This release is available as a Docker image:" >> release_notes.md + echo '```bash' >> release_notes.md + echo "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF_NAME#v}" >> release_notes.md + echo '```' >> release_notes.md + echo "" >> release_notes.md + if [ -z "$PREVIOUS_TAG" ]; then + echo "**Full Changelog**: https://github.com/${{ github.repository }}/commits/${GITHUB_REF_NAME}" >> release_notes.md + else + echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_TAG}...${GITHUB_REF_NAME}" >> release_notes.md + fi + + cat release_notes.md + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + body_path: release_notes.md + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/Dockerfile b/Dockerfile index b34da84..2d89598 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,8 +29,8 @@ COPY plugins ./plugins COPY themes ./themes COPY generate_password.py . -# Create data directories -RUN mkdir -p data/notes data/search_index +# Create data directory +RUN mkdir -p data # Expose port EXPOSE 8000 diff --git a/README.md b/README.md index 0773789..142f973 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Use the pre-built image directly from GHCR - no building required! > # Now you have everything - run docker-compose below > ``` -> **πŸ” Security Note**: Authentication is **enabled by default** with password `admin`. For testing/local use, this is fine. If exposing to a network, **change the password immediately** - see [AUTHENTICATION.md](data/notes/AUTHENTICATION.md) for instructions. +> **πŸ” Security Note**: Authentication is **enabled by default** with password `admin`. For testing/local use, this is fine. If exposing to a network, **change the password immediately** - see [AUTHENTICATION.md](data/AUTHENTICATION.md) for instructions. **Option 1: Docker Compose (Recommended)** @@ -98,6 +98,7 @@ curl -O https://raw.githubusercontent.com/gamosoft/notediscovery/main/docker-com docker-compose -f docker-compose.ghcr.yml up -d # Access at http://localhost:8000 +# Login with default password: admin # View logs docker-compose -f docker-compose.ghcr.yml logs -f @@ -207,7 +208,7 @@ Once you've started NoteDiscovery, you'll find comprehensive guides on: - 🌐 **API.md** - REST API documentation and examples - πŸ” **AUTHENTICATION.md** - Enable password protection for your instance -**Can't wait to start the app?** Browse the documentation notes directly on GitHub in the [`data/notes/`](data/notes/) folder! +**Can't wait to start the app?** Browse the documentation notes directly on GitHub in the [`data/`](data/) folder! πŸ’‘ **Tip:** These documentation files are regular markdown notesβ€”edit them, add your own notes, or use them as templates. It's your knowledge base! @@ -228,14 +229,14 @@ NoteDiscovery is designed for **self-hosted, private use**. Please keep these se ### Authentication - **Password protection is ENABLED by default** with password: `admin` - ⚠️ **CHANGE THE DEFAULT PASSWORD IMMEDIATELY** if exposing to a network! -- See **[AUTHENTICATION.md](data/notes/AUTHENTICATION.md)** for complete setup instructions +- See **[AUTHENTICATION.md](data/AUTHENTICATION.md)** for complete setup instructions - To disable auth, set `security.enabled: false` in `config.yaml` - Change password with Docker: `docker-compose exec notediscovery python generate_password.py` - Perfect for single-user or small team deployments - For multi-user setups, consider a reverse proxy with OAuth/SSO ### Data Privacy -- Your notes are stored as **plain text markdown files** in `data/notes/` +- Your notes are stored as **plain text markdown files** in `data/` - No data is sent to external services - Regular backups are recommended diff --git a/backend/utils.py b/backend/utils.py index 1f1d654..aa361b7 100644 --- a/backend/utils.py +++ b/backend/utils.py @@ -35,8 +35,6 @@ def ensure_directories(config: dict): config['storage']['notes_dir'], config['storage']['plugins_dir'], ] - if config['search']['enabled']: - dirs.append(config['search']['index_dir']) for dir_path in dirs: Path(dir_path).mkdir(parents=True, exist_ok=True) diff --git a/config.yaml b/config.yaml index 993218b..dd44630 100644 --- a/config.yaml +++ b/config.yaml @@ -12,12 +12,11 @@ server: reload: false # Set to true for development storage: - notes_dir: "./data/notes" + notes_dir: "./data" plugins_dir: "./plugins" search: enabled: true - index_dir: "./data/search_index" security: # Authentication settings diff --git a/data/notes/API.md b/data/API.md similarity index 100% rename from data/notes/API.md rename to data/API.md diff --git a/data/notes/AUTHENTICATION.md b/data/AUTHENTICATION.md similarity index 100% rename from data/notes/AUTHENTICATION.md rename to data/AUTHENTICATION.md diff --git a/data/notes/FEATURES.md b/data/FEATURES.md similarity index 100% rename from data/notes/FEATURES.md rename to data/FEATURES.md diff --git a/data/notes/MATHJAX.md b/data/MATHJAX.md similarity index 100% rename from data/notes/MATHJAX.md rename to data/MATHJAX.md diff --git a/data/notes/PLUGINS.md b/data/PLUGINS.md similarity index 100% rename from data/notes/PLUGINS.md rename to data/PLUGINS.md diff --git a/data/notes/PLUGINS/Note Statistics.md b/data/PLUGIN_NOTE_STATISTICS.md similarity index 100% rename from data/notes/PLUGINS/Note Statistics.md rename to data/PLUGIN_NOTE_STATISTICS.md diff --git a/data/notes/THEMES.md b/data/THEMES.md similarity index 100% rename from data/notes/THEMES.md rename to data/THEMES.md diff --git a/docker-compose.ghcr.yml b/docker-compose.ghcr.yml index de5bcc7..6101c02 100644 --- a/docker-compose.ghcr.yml +++ b/docker-compose.ghcr.yml @@ -5,7 +5,7 @@ services: ports: - "8000:8000" volumes: - # Persist notes and data (inside 'notes' folder) + # Persist notes and data - ./data:/app/data # Custom plugins - ./plugins:/app/plugins diff --git a/docker-compose.yml b/docker-compose.yml index 5d7f5cd..843eb96 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: ports: - "8000:8000" volumes: - # Persist notes and data (inside 'notes' folder) + # Persist notes and data - ./data:/app/data # Custom plugins - ./plugins:/app/plugins diff --git a/run.py b/run.py index bacf027..470ae4c 100644 --- a/run.py +++ b/run.py @@ -20,8 +20,7 @@ def main(): subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"]) # Create data directories - Path("data/notes").mkdir(parents=True, exist_ok=True) - Path("data/search_index").mkdir(parents=True, exist_ok=True) + Path("data").mkdir(parents=True, exist_ok=True) Path("plugins").mkdir(parents=True, exist_ok=True) print("βœ“ Dependencies installed") @@ -32,7 +31,7 @@ def main(): print("\nπŸ“ Open your browser to: http://localhost:8000") print("\nπŸ’‘ Tips:") print(" - Press Ctrl+C to stop the server") - print(" - Your notes are in ./data/notes/") + print(" - Your notes are in ./data/") print(" - Plugins go in ./plugins/") print("\n" + "="*50 + "\n")