Skip to content

Commit

Permalink
🎉 initial source: add project #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen215 committed May 12, 2024
0 parents commit 1078bac
Show file tree
Hide file tree
Showing 17 changed files with 845 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

111 changes: 111 additions & 0 deletions .github/workflows/ci_notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Notify

on:
push:
branches: ["master"]
tags:
- "v*"
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

notify:
runs-on: ubuntu-latest
needs: build
steps:
- name: Check Secrets
id: check
run: |
if [[ -z "${{ secrets.TELEGRAM_CHAT_ID }}" || -z "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
echo "::set-output name=skip::true"
else
echo "::set-output name=skip::false"
fi
- name: Send Telegram Notification
if: steps.check.outputs.skip == 'false'
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
format: markdown
message: |
🚀 CI Commit
🔯 `${{ github.actor }}` created commit:
- message: `${{ github.event.commits[0].message }}`
- hash: `${{ github.sha }}`
- repository: `${{ github.repository }}`
- head: `${{ github.event.head_commit.message }}`
🍀 See changes: `https://github.com/${{ github.repository }}/commit/${{github.sha}}`
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check if tag exists
id: check_tag
run: |
if [ -n "$GITHUB_REF" ]; then
TAG=${GITHUB_REF#refs/tags/}
# echo "::set-output name=tag::$TAG"
echo "TAG=${TAG}" >> $GITHUB_ENV
else
# echo "::set-output name=tag::"
echo "TAG=" >> $GITHUB_ENV
fi
shell: bash

- name: Check Secrets
id: check
run: |
if [[ -z "${{ secrets.TELEGRAM_CHAT_ID }}" || -z "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
echo "::set-output name=skip::true"
else
echo "::set-output name=skip::false"
fi
- name: Generate Changelog
id: changelog
run: |
# Generate your changelog here and set it as an output variable
CHANGELOG=$(git log --pretty=format:"%h - %s" -n 10)
echo "::set-output name=changelog::$CHANGELOG"
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG }}
body: |
:gem: released new version ${{ env.TAG }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Send Telegram Notification
if: steps.check.outputs.skip == 'false'
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
format: markdown
message: |
🚀 New tag created: **${{ env.TAG }}**
🔯 `${{ github.actor }}` created tag:
- repository: `${{ github.repository }}`
- head: `${{ github.event.head_commit.message }}`
🍀 See changes: `https://github.com/${{ github.repository }}/releases/tag/${{ env.TAG }}`
📜 Changelog:
`${{ steps.changelog.outputs.changelog }}`
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
logs/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**
!**/src/test/**
plugin/build/
plugin/bin/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
src/main/java/META-INF/
*.gz
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: build test jar clean

build:
./gradlew jar

clean:
./gradlew clean

jar: build

list-task:
./gradlew tasks

test:
./gradlew test

groovy:
./gradlew build
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# wizard4j

## Introduction

wizard4j: A Java 1.8 library offering a robust collection of utility functions for streamlined development.

## Features

- Comprehensive set of utility functions.
- Written in Java 1.8.
- Well-documented code for easy understanding.
- Regular updates and maintenance.

## Installation

```bash
git clone --depth 1 https://github.com/sivaosorg/wizard4j.git
```

## Generation Plugin Java

```bash
curl https://gradle-initializr.cleverapps.io/starter.zip -d type=groovy-gradle-plugin -d testFramework=testng -d projectName=wizard4j -o wizard4j.zip
```

## Modules

Explain how users can interact with the various modules.

### Tidying up

To tidy up the project's Java modules, use the following command:

```bash
./gradlew clean
```

or

```bash
make clean
```

### Building SDK

```bash
./gradlew jar
```

or

```bash
make jar
```

### Upgrading version

- file `gradle.properties`

```sh
ng.name=wizard4j
ng.version=v1.0.0
```

## Integration

1. Add dependency into file `build.gradle`

```gradle
implementation files('libs/wizard4j-v1.0.0.jar') // filename based on ng.name and ng.version
```

2. Edit file `main Spring Boot application` (optional)

```java

@SpringBootApplication
@ComponentScan(basePackages = {"org.wizard4j"}) // root name of package wizard4j
public class ApiApplication {
public static void main(String[] args) {
SpringApplication.run(ApiApplication.class, args);
}
}
```
53 changes: 53 additions & 0 deletions VERSION_RELEASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Version Releases

## Semantic Versioning (SemVer): `vMAJOR.MINOR.PATCH`

Example:

- v1.0.0
- v1.0.1
- v1.1.1

## Pre-release versions: `vMAJOR.MINOR.PATCH-<BETA/RC/SNAPSHOT>.<number>`

Example:

- v1.0.0-beta.1
- v1.0.0-beta.2
- v1.2.3-rc1
- v1.2.3-SNAPSHOT

## Post-release versions: `vMAJOR.MINOR.PATCH-POST.<number>`

Example:

- v1.2.3-post.1
- v1.2.3-post.2

## Local versions: `vMAJOR.MINOR.PATCH+LOCAL`

Example:

- v1.0.0+local
- v1.1.0+local

## Caret range versions: `^MAJOR.MINOR.PATCH`

Example:

- ^1.2.3 (similar `>=1.2.3 < 2.0.0`)

## Tilde range versions: `~MAJOR.MINOR.PATCH`

Example:

- ~1.2.3 (similar `>=1.2.3 <1.3.0`)

---

Notes:

- `MAJOR`: major version.
- `MINOR`: Minor version, often adding new features.
- `PATCH`: Patch version, typically fixing bugs.
- `SNAPSHOT`: Indicates a version under development or in progress. It is often used to represent the latest state of the codebase and may include ongoing changes and features that are not yet finalized. This allows developers to work with the most recent developments in a project.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ng.name=wizard4j
ng.version=v1.0.0
8 changes: 8 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format

[versions]
spock-core = "2.2-groovy-3.0"

[libraries]
spock-core = { module = "org.spockframework:spock-core", version.ref = "spock-core" }
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 1078bac

Please sign in to comment.