-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from krrishnaaaa/update
Organised the application and added build jobs
- Loading branch information
Showing
19 changed files
with
879 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: 🔨 Build and Check PR 🚀 | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository 📂 | ||
- name: 📥 Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up Zulu JDK 17 ☕ | ||
- name: ☕ Set up Zulu JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' # Set the desired JDK version | ||
distribution: 'zulu' # Specify Zulu as the distribution | ||
|
||
# Step 3: Build the project 🔨 | ||
- name: 🔨 Run Gradle build | ||
run: ./gradlew build --no-daemon | ||
|
||
# Step 4: Create the shadow JAR 📦 | ||
- name: 🛠️ Build Shadow JAR | ||
run: ./gradlew shadowJar --no-daemon | ||
|
||
# Step 5: Get the name of the generated jar file | ||
- name: 🧾 Get the shadowJar file name | ||
id: get_jar_name | ||
run: | | ||
JAR_NAME=$(basename build/libs/*.jar) | ||
echo "jar_name=$JAR_NAME" >> $GITHUB_ENV | ||
# Step 6: Upload the shadowJar artifact (optional) 🎁 | ||
- name: 🎁 Upload shadowJar | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.jar_name }} | ||
path: build/libs/${{ env.jar_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Create Release 🎉 | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # Trigger on version tag pushes (e.g., v1.0, v2.0) | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: 🛎️ Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up JDK (using Zulu) | ||
- name: ☕ Set up Zulu JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' # Specify the JDK version | ||
distribution: 'zulu' | ||
|
||
# Step 3: Build the project and create shadowJar | ||
- name: 🚧 Build with Gradle | ||
run: ./gradlew shadowJar --no-daemon | ||
|
||
# Step 4: Create a new release | ||
- name: 📦 Create Release | ||
id: create_release | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const { exec } = require('child_process'); | ||
const { promises: fs } = require('fs'); | ||
// Get the latest tag | ||
const tag = context.ref.replace('refs/tags/', ''); | ||
// Read the release notes if available | ||
const releaseNotes = await fs.readFile('CHANGELOG.md', 'utf-8').catch(() => 'No release notes.'); | ||
// Create the release | ||
const release = await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: tag, | ||
name: tag, | ||
body: releaseNotes, | ||
draft: false, | ||
prerelease: false, | ||
}); | ||
return release.data; | ||
# Step 5: Upload the shadowJar artifact to the release | ||
- name: 🎁 Upload shadowJar to Release | ||
id: upload_jar | ||
run: | | ||
# Find the generated JAR file name | ||
jar_file=$(ls build/libs/*.jar | grep -v '\-javadoc' | grep -v '\-sources' | head -n 1) | ||
echo "Found JAR file: $jar_file" | ||
echo "jar_file_name=$jar_file" >> $GITHUB_ENV | ||
- name: 🎁 Upload shadowJar to Release | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ env.jar_file_name }} | ||
asset_name: ${{ env.jar_file_name }} # Use the dynamic name here | ||
asset_content_type: application/java-archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Changelog | ||
|
||
## [Version 1.0] | ||
|
||
### Added | ||
- Flag-based operations for **find** and **delete** functionalities, allowing users to specify operations more clearly using command-line flags. | ||
|
||
### Changed | ||
- Organized the project structure using **Gradle**, making it easier to manage dependencies and build processes. | ||
|
||
### Updated | ||
- Integrated JAR file usage for executing the application, simplifying the running process for users. | ||
|
||
### Removed | ||
- Manual compilation steps are no longer required, enhancing user experience and reducing setup complexity. | ||
|
||
### Examples | ||
- **Find duplicates**: | ||
```bash | ||
java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --find <directory1> <directory2> [...] | ||
``` | ||
|
||
- **Delete files**: | ||
```bash | ||
java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --delete <file> | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.