Skip to content

Commit 79a11ce

Browse files
authored
Updated base (#10)
* Not updated section. Update you and contribute to this section. Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Not updated section. Update you and contribute to this section. Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Updated Readme Signed-off-by: https://github.com/Someshdiwan <[email protected]> * README.md Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Add ArrayListDemo7 to explore constructors and methods via reflection This demo showcases how to use Java Reflection API to inspect the internal structure of the ArrayList class. Key highlights: • Obtains the Class object for java.util.ArrayList using ArrayList.class. • Retrieves all declared constructors with getDeclaredConstructors(). • Retrieves all declared methods with getDeclaredMethods(). • Iterates over constructors and methods, printing their names. Why this is useful: • Demonstrates reflection capabilities for runtime class inspection. • Helps understand how many constructors and methods exist inside core library classes like ArrayList. • Useful for debugging, framework design, and meta-programming tasks where behavior adapts based on runtime class analysis. Output: - Prints the list of all constructor signatures of ArrayList. - Prints the names of all methods (public, protected, private, and package-private declared within ArrayList). Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Added How Java Works Signed-off-by: https://github.com/Someshdiwan <[email protected]> * docs(core-concepts): add overview of Streams, Collections Framework, and Generics What - Added a detailed documentation file covering three foundational Java concepts: 1. Streams → declarative, functional data processing with filter/map/reduce and parallelism. 2. Collections Framework → core data structures (List, Set, Map, Queue) and their integration in back-end, front-end, and frameworks. 3. Generics → type-safety, reusability, and readability improvements with generic classes/interfaces. - Included structured sections: - Concept explanation - Practical applications - Real-world usage across back-end, microservices, UI, and middleware. - Provided a concise summary that positions these three concepts as the backbone of scalable Java development. Why - These three concepts are central to modern Java programming across domains. - Developers often use them together (e.g., Collections hold data, Streams process it, Generics enforce type safety). - A unified overview makes it easier to understand how they interconnect and why mastering them is essential for enterprise-grade applications. Logic 1. **Streams** - Emphasized functional, declarative style over imperative loops. - Highlighted back-end data manipulation, parallel computation, and event/log pipelines. - Showed relevance in high-throughput systems like Spring Boot services or analytics. 2. **Collections Framework** - Identified as the backbone of Java applications. - Explained usage in back-end (DB results, caching), front-end/mobile (UI state, adapters), and frameworks (Spring, Hibernate). - Reinforced importance as building blocks for nearly all Java data-handling code. 3. **Generics** - Explained compile-time type safety preventing runtime ClassCastException. - Showed reusability via type-safe repositories, DTOs, and custom utilities. - Clarified benefits of reduced boilerplate and increased readability. 4. **Real-World Applications** - Connected Streams, Collections, and Generics into enterprise workflows: - Back-end data processing (Collections + Streams). - Microservices aggregation (Streams + Generics for DTOs). - UI/mobile apps (Collections + Generics for model binding). - Utility libraries (all three for flexibility and safety). Real-life applications - Enterprise back-end: Streams filter/aggregate DB records, Collections cache them, Generics enforce DTO typing. - Microservices: Streams combine service results, Generics enable reusable interfaces across APIs. - UI/Mobile apps: Collections model UI data, Streams transform it, Generics prevent runtime casting errors. - Middleware/utility libraries: Provide type-safe, reusable APIs built on Collections and Generics. Notes - ✔ Streams = declarative, functional pipelines for data. - ✔ Collections = robust, reusable data structures. - ✔ Generics = compile-time safety + reusable APIs. - Together, these form the core triad for efficient, scalable, and maintainable Java systems. Signed-off-by: https://github.com/Someshdiwan <[email protected]> * "chore: add robust .gitattributes + .editorconfig (cross-platform)". Signed-off-by: https://github.com/Someshdiwan <[email protected]> * docs(paradigms): add detailed explanation of Declarative Programming with Java examples What - Documented the concept of **Declarative Programming** vs **Imperative Programming**. - Highlighted key characteristics: - Focus on *what* to achieve, not *how* to achieve it. - High-level abstraction with less boilerplate code. - Execution strategy left to underlying system (e.g., SQL engine, Streams). - Provided concrete examples across multiple domains: - **SQL** → `SELECT * FROM students WHERE marks > 90` (declarative query). - **Java Streams** → `list.stream().filter(...).map(...).toList()` (functional transformations). - **HTML/CSS** → structure and styling declaratively described. - Outlined benefits: - Conciseness, readability, maintainability. - Easier parallelization via declarative APIs. - Added **Java-specific comparison**: - Imperative sum of even numbers (loops + conditions). - Declarative sum using Streams API (`filter`, `mapToInt`, `sum`). Why - Declarative programming is central to modern Java (Streams, Lambdas, functional style). - Developers often confuse *control flow* with *business logic*; declarative style separates the two. - This doc clarifies when and why declarative approaches are preferred in enterprise apps. Logic 1. **Definition** - Declarative = specify outcome, not steps. - Contrasted with imperative = specify exact flow (loops, state changes). 2. **Key Characteristics** - Abstraction of execution. - Focus on results instead of algorithmic details. - Reduction of verbosity and control structures. 3. **Examples** - SQL → declare query logic without procedural fetch. - Streams → pipelines describe transformation, not iteration. - HTML → structure declaration, not rendering process. 4. **Java Focus** - Streams API embodies declarative patterns (map/filter/reduce). - Shows improved readability and parallelization compared to traditional loops. Real-life applications - **Database queries (SQL)**: write intent-driven queries, let DBMS handle execution plan. - **Back-end APIs (Java Streams)**: declarative transformations for business rules. - **UI layer (HTML/CSS)**: declaratively specify layout and style, browsers handle rendering. - **Parallel data processing**: declarative pipelines allow frameworks to optimize multithreaded execution. Notes - Declarative ≠ “no control,” but rather offloading control to libraries/engines. - Imperative code is sometimes necessary for low-level optimization, but declarative style is preferred for clarity. - Java’s `Stream.parallel()` demonstrates how declarative style enables automatic performance improvements. Signed-off-by: https://github.com/Someshdiwan <[email protected]> * docs(streams): add detailed explanation of Primitive Streams (IntStream, LongStream, DoubleStream) What - Documented **Primitive Streams in Java** and their role in numerical data processing. - Covered: - Definition and difference from object-based streams. - Specialized types: IntStream, LongStream, DoubleStream. - Built-in numeric methods (sum, average, min, max, summaryStatistics). - Benefits: performance optimization, readability, specialized numeric APIs. - Explained real-world applications across back-end systems, analytics, financial apps, and middleware. - Provided example using IntStream.rangeClosed(1, 100).sum(). - Added notes on integration with other APIs (boxed conversion, Collectors aggregation). Why - Standard `Stream<Integer>` incurs autoboxing/unboxing overhead, reducing efficiency in numeric-heavy workloads. - Primitive Streams solve this by working directly with primitives (int, long, double). - They are critical in performance-sensitive domains such as analytics, finance, and real-time monitoring. - Understanding their role ensures developers can write cleaner, faster, and more maintainable numeric pipelines. Logic 1. **Specialized Stream Types** - `IntStream` → operations on int values. - `LongStream` → operations on long values. - `DoubleStream` → operations on double values. 2. **Performance Advantage** - Avoids autoboxing/unboxing (`int ↔ Integer`). - Reduces memory usage and GC pressure. - Better suited for large-scale numeric operations. 3. **Built-in Numeric Methods** - Directly provides `sum()`, `average()`, `min()`, `max()`, and `summaryStatistics()`. - Eliminates need for manual reduction/aggregation logic. 4. **Integration** - `boxed()` → converts primitive streams to object streams when APIs require `Stream<T>`. - Works seamlessly with Collectors for statistical reporting. Real-world applications - **Back-End Processing**: Sales aggregation, DB report generation. - **Financial Systems**: Risk models, moving averages, high-frequency trading data. - **Analytics/Scientific Computing**: Sensor data, simulations, dashboards. - **Middleware/Utilities**: Reusable numeric helper APIs, parallel data crunching. Notes - Prefer primitive streams for numeric-heavy workloads. - Use `parallel()` when large datasets benefit from multicore processing. - Convert to boxed streams only when integration requires object types. - Leverage `summaryStatistics()` for concise statistical reporting. Signed-off-by: https://github.com/Someshdiwan <[email protected]> * How Data Is Stored Internally In HashMap Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Difference Between this and super in Java. Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Explain use of this keyword.txt Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Difference Between This and Super in Java.md Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Real-World Analogy for this vs super.md Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Disadvantages of Synchronized in Java Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Understanding Executors Cached Thread Pool.txt Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Thread Pooling Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Differences Between TreeMap and HashMap Detailed.txt Signed-off-by: https://github.com/Someshdiwan <[email protected]> * TreeMap Insertion Red-Black Balancing.txt Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Red Black Balancing Tree Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Plain BST vs Tree Map.md Signed-off-by: https://github.com/Someshdiwan <[email protected]> * This vs Super Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Updated normalize text files and keep LF in the repo. now Windows file support can clone repo. Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Updated workflow Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram-notify.yml Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram-notify.yml Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram notify Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: testing workflows for telegram commits Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Done Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Done Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Done Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Updated Done Final Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Updated Done Final Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Updated Animation Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Updated Animation File Signed-off-by: https://github.com/Someshdiwan <[email protected]> * feat: Updated Animation File Signed-off-by: https://github.com/Someshdiwan <[email protected]> * Update Telegram updates banner: continuous loop animation + clickable link in README.md. Signed-off-by: https://github.com/Someshdiwan <[email protected]> --------- Signed-off-by: https://github.com/Someshdiwan <[email protected]>
1 parent ecf1c9f commit 79a11ce

File tree

33 files changed

+651
-59
lines changed

33 files changed

+651
-59
lines changed

.editorconfig

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Top-level EditorConfig
2+
root = true
3+
4+
# ----------------------------------------------------------------------
5+
# Defaults for all files
6+
# ----------------------------------------------------------------------
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
# Keep Markdown trailing spaces (they may mean line breaks)
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
# Java / Kotlin / Gradle (4 spaces)
18+
[*.{java,kt,gradle}]
19+
indent_style = space
20+
indent_size = 4
21+
22+
# Python (4 spaces)
23+
[*.py]
24+
indent_style = space
25+
indent_size = 4
26+
27+
# JavaScript / TypeScript / JSX / TSX (2 spaces)
28+
[*.{js,jsx,ts,tsx}]
29+
indent_style = space
30+
indent_size = 2
31+
32+
# JSON (2 spaces)
33+
[*.json]
34+
indent_style = space
35+
indent_size = 2
36+
37+
# YAML (2 spaces)
38+
[*.{yml,yaml}]
39+
indent_style = space
40+
indent_size = 2
41+
42+
# XML (2 spaces)
43+
[*.xml]
44+
indent_style = space
45+
indent_size = 2
46+
47+
# Shell scripts (2 spaces)
48+
[*.{sh,bash}]
49+
indent_style = space
50+
indent_size = 2
51+
52+
# Windows scripts
53+
[*.{cmd,bat,ps1}]
54+
indent_style = space
55+
indent_size = 2
56+
57+
# Properties files (2 spaces; avoid tabs)
58+
[*.properties]
59+
indent_style = space
60+
indent_size = 2
61+
62+
# Makefiles must use tabs
63+
[Makefile]
64+
indent_style = tab
65+
tab_width = 4

.gitattributes

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# ------------------------------------------------------------------------------
2+
# Core: normalize text files and keep LF in repo
3+
# ------------------------------------------------------------------------------
4+
* text=auto eol=lf
5+
6+
# ------------------------------------------------------------------------------
7+
# Source code (force LF)
8+
# ------------------------------------------------------------------------------
9+
*.java text eol=lf
10+
*.kt text eol=lf
11+
*.py text eol=lf
12+
*.js text eol=lf
13+
*.jsx text eol=lf
14+
*.ts text eol=lf
15+
*.tsx text eol=lf
16+
*.html text eol=lf
17+
*.css text eol=lf
18+
*.scss text eol=lf
19+
*.md text eol=lf
20+
*.txt text eol=lf
21+
*.xml text eol=lf
22+
*.json text eol=lf
23+
*.yml text eol=lf
24+
*.yaml text eol=lf
25+
*.sh text eol=lf
26+
*.bash text eol=lf
27+
*.gradle text eol=lf
28+
*.properties text eol=lf
29+
*.sql text eol=lf
30+
*.c text eol=lf
31+
*.cpp text eol=lf
32+
*.h text eol=lf
33+
34+
# ------------------------------------------------------------------------------
35+
# Binary files (never touch line endings / no diffs)
36+
# ------------------------------------------------------------------------------
37+
*.png binary
38+
*.jpg binary
39+
*.jpeg binary
40+
*.gif binary
41+
*.ico binary
42+
*.svg binary
43+
*.webp binary
44+
*.pdf binary
45+
*.jar binary
46+
*.war binary
47+
*.class binary
48+
*.dll binary
49+
*.exe binary
50+
*.so binary
51+
*.dylib binary
52+
*.db binary
53+
*.sqlite binary
54+
*.zip binary
55+
*.tar binary
56+
*.tar.gz binary
57+
*.tgz binary
58+
*.7z binary
59+
*.gz binary
60+
*.xz binary
61+
*.bz2 binary
62+
63+
# ------------------------------------------------------------------------------
64+
# Diff & merge hygiene
65+
# ------------------------------------------------------------------------------
66+
# Treat as text (better diffs)
67+
*.md text
68+
*.json text
69+
*.xml text
70+
*.yml text
71+
*.yaml text
72+
*.sql text
73+
74+
# Lockfiles rarely need diffs
75+
package-lock.json -diff
76+
yarn.lock -diff
77+
pnpm-lock.yaml -diff
78+
*.lock -diff
79+
80+
# Force binary merges
81+
*.jar merge=binary
82+
*.class merge=binary
83+
*.dll merge=binary
84+
*.exe merge=binary
85+
*.so merge=binary
86+
*.dylib merge=binary
87+
*.db merge=binary
88+
*.sqlite merge=binary
89+
*.pdf merge=binary
90+
*.png merge=binary
91+
*.jpg merge=binary
92+
*.jpeg merge=binary
93+
*.gif merge=binary
94+
*.ico merge=binary
95+
*.svg merge=binary
96+
*.webp merge=binary
97+
*.zip merge=binary
98+
*.tar merge=binary
99+
*.tar.gz merge=binary
100+
*.tgz merge=binary
101+
*.7z merge=binary
102+
*.gz merge=binary
103+
*.xz merge=binary
104+
*.bz2 merge=binary
105+
106+
# Lock files: prefer ours
107+
*.lock merge=ours
108+
109+
# ------------------------------------------------------------------------------
110+
# GitHub Linguist overrides (make languages visible in stats)
111+
# ------------------------------------------------------------------------------
112+
*.yml linguist-detectable=true
113+
*.yaml linguist-detectable=true
114+
*.xml linguist-detectable=true
115+
*.json linguist-detectable=true
116+
*.md linguist-detectable=true
117+
*.sql linguist-detectable=true
118+
*.md linguist-detectable=true linguist-language=Markdown
119+
*.txt linguist-detectable=true
120+
121+
# Force correct language classification
122+
*.xml linguist-language=XML
123+
*.json linguist-language=JSON
124+
*.yml linguist-language=YAML
125+
*.yaml linguist-language=YAML
126+
*.sql linguist-language=SQL
127+
*.md linguist-detectable=true linguist-language=Markdown
128+
*.txt linguist-detectable=true
129+
130+
# ------------------------------------------------------------------------------
131+
# Export settings (exclude from `git archive`)
132+
# ------------------------------------------------------------------------------
133+
.gitattributes export-ignore
134+
.gitignore export-ignore
135+
.github/ export-ignore
136+
tools/ export-ignore

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Require Someshdiwan to approve any changes to workflow files
2+
/.github/workflows/ @Someshdiwan
3+
/.github/workflows/** @Someshdiwan
Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,97 @@
1-
name: "Deploy Jekyll with GitHub Pages (robust)"
1+
# .github/workflows/jekyll-pages.yml
2+
name: Deploy Jekyll with GitHub Pages (robust)
23

34
on:
45
push:
5-
branches:
6-
- main
7-
- master
6+
branches: [ main, master ]
87
workflow_dispatch: {}
98
schedule:
10-
# Run daily at 3:00 AM IST (21:30 UTC previous day)
11-
- cron: '30 21 * * *'
9+
# Daily at 3:00 AM IST (21:30 UTC previous day)
10+
- cron: "30 21 * * *"
1211

12+
# Least privilege for Pages
1313
permissions:
1414
contents: read
1515
pages: write
1616
id-token: write
1717

18+
# Prevent overlapping deploys per ref
1819
concurrency:
19-
group: "pages-${{ github.ref }}"
20+
group: pages-${{ github.ref }}
2021
cancel-in-progress: false
2122

2223
jobs:
2324
build:
25+
# 🚫 Never run from forks / external PRs
26+
if: >
27+
github.repository == 'Someshdiwan/JavaEvolution-Learning-Growing-Mastering' &&
28+
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
2429
name: Build site (Jekyll)
2530
runs-on: ubuntu-latest
2631
timeout-minutes: 30
32+
2733
steps:
28-
- name: Checkout repository
34+
- name: Checkout
2935
uses: actions/checkout@v4
3036
with:
3137
submodules: true
3238
fetch-depth: 0
3339

34-
- name: Setup Pages (configure Pages environment)
40+
- name: Configure Pages
3541
uses: actions/configure-pages@v5
3642

3743
- name: Detect Gemfile location
38-
id: detect_gemfile
44+
id: detect
45+
shell: bash
3946
run: |
4047
if [ -f "site/Gemfile" ]; then
41-
echo "gem_dir=site" >> $GITHUB_OUTPUT
48+
echo "gem_dir=site" >> "$GITHUB_OUTPUT"
4249
echo "Found Gemfile in site/"
4350
elif [ -f "Gemfile" ]; then
44-
echo "gem_dir=." >> $GITHUB_OUTPUT
51+
echo "gem_dir=." >> "$GITHUB_OUTPUT"
4552
echo "Found Gemfile in repo root"
4653
else
47-
echo "gem_dir=NONE" >> $GITHUB_OUTPUT
48-
echo "No Gemfile found in site/ or repo root — will use Jekyll builder action fallback."
54+
echo "gem_dir=NONE" >> "$GITHUB_OUTPUT"
55+
echo "No Gemfile found; will use jekyll-build-pages fallback."
4956
fi
5057
51-
# If Gemfile exists, set up Ruby + Bundler and build with bundle exec
52-
- name: Set up Ruby (only when Gemfile present)
53-
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
58+
# Fast path: use the repo's Gemfile (caches automatically)
59+
- name: Setup Ruby (bundler cache)
60+
if: ${{ steps.detect.outputs.gem_dir != 'NONE' }}
5461
uses: ruby/setup-ruby@v1
5562
with:
5663
ruby-version: '3.2'
57-
bundler-cache: false
58-
59-
- name: Cache bundler gems (only when Gemfile present)
60-
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
61-
uses: actions/cache@v4
62-
id: cache-bundler
63-
with:
64-
path: vendor/bundle
65-
key: ${{ runner.os }}-gems-${{ steps.detect_gemfile.outputs.gem_dir }}-${{ hashFiles(format('{0}/Gemfile.lock', steps.detect_gemfile.outputs.gem_dir)) }}
66-
restore-keys: |
67-
${{ runner.os }}-gems-${{ steps.detect_gemfile.outputs.gem_dir }}-
68-
69-
- name: Install Ruby gems with Bundler (only when Gemfile present)
70-
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
71-
run: |
72-
echo "Using Gemfile from: ${{ steps.detect_gemfile.outputs.gem_dir }}"
73-
cd ${{ steps.detect_gemfile.outputs.gem_dir }}
74-
bundle config set --local path 'vendor/bundle'
75-
# retry logic to cope with transient network errors
76-
bundle install --jobs 4 --retry 3
77-
shell: bash
64+
bundler-cache: true
65+
# cache & install are scoped to where the Gemfile lives
66+
working-directory: ${{ steps.detect.outputs.gem_dir }}
7867

79-
- name: Build site with Bundler (only when Gemfile present)
80-
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
81-
run: |
82-
cd ${{ steps.detect_gemfile.outputs.gem_dir }}
83-
echo "Building Jekyll with bundle exec..."
84-
bundle exec jekyll build --source . --destination ../_site
68+
- name: Build with bundle exec
69+
if: ${{ steps.detect.outputs.gem_dir != 'NONE' }}
70+
working-directory: ${{ steps.detect.outputs.gem_dir }}
8571
env:
8672
JEKYLL_ENV: production
8773
shell: bash
74+
run: |
75+
echo "Building Jekyll from $(pwd)…"
76+
bundle exec jekyll build --source . --destination "${GITHUB_WORKSPACE}/_site"
8877
89-
# Fallback: if there's no Gemfile, use the jekyll-build-pages action (best-effort)
78+
# Fallback: no Gemfile; use the official builder (looks in ./site by default)
9079
- name: Build with actions/jekyll-build-pages (fallback)
91-
if: ${{ steps.detect_gemfile.outputs.gem_dir == 'NONE' }}
80+
if: ${{ steps.detect.outputs.gem_dir == 'NONE' }}
9281
uses: actions/jekyll-build-pages@v1
9382
with:
9483
source: ./site
9584
destination: ./_site
9685

9786
- name: Validate _site exists
87+
shell: bash
9888
run: |
9989
if [ ! -d "_site" ]; then
100-
echo "_site wasn't generated — failing the job."
90+
echo "::error::_site was not generated."
10191
ls -la
10292
exit 1
10393
fi
94+
echo "✅ _site generated."
10495
10596
- name: Upload Pages artifact
10697
uses: actions/upload-pages-artifact@v3
@@ -109,17 +100,21 @@ jobs:
109100
name: java-evolution-pages
110101

111102
deploy:
103+
# 🚫 Never run from forks / external PRs
104+
if: >
105+
github.repository == 'Someshdiwan/JavaEvolution-Learning-Growing-Mastering' &&
106+
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
112107
name: Deploy to GitHub Pages
113108
needs: build
114109
runs-on: ubuntu-latest
115110
environment:
116111
name: github-pages
117112
steps:
118-
- name: Deploy to GitHub Pages
113+
- name: Deploy
119114
id: deployment
120115
uses: actions/deploy-pages@v4
121116
with:
122117
artifact_name: java-evolution-pages
123118

124-
- name: Output deploy URL
119+
- name: Show URL
125120
run: echo "Deployed to ${{ steps.deployment.outputs.page_url }}"

0 commit comments

Comments
 (0)