-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b90ced1
Showing
108 changed files
with
3,064 additions
and
0 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,3 @@ | ||
/gradlew text eol=lf | ||
*.bat text eol=crlf | ||
*.jar binary |
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,210 @@ | ||
# Release Workflow | ||
# This workflow is triggered when a version tag is pushed and performs the following: | ||
# | ||
# 1. Version Verification: | ||
# - Checks if the version in version.properties matches the tag version | ||
# - Fails if versions don't match, preventing accidental mismatched releases | ||
# | ||
# 2. Build Process: | ||
# - Only proceeds if version verification passes | ||
# - Builds the application and creates release artifacts | ||
# | ||
# To create a release: | ||
# 1. Update version.properties with the new version | ||
# 2. Commit and push the change | ||
# 3. Create and push a tag matching the version (e.g., v1.0.0) | ||
|
||
name: Build and Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+*' # Semantic versioning tags only | ||
|
||
env: | ||
JAVA_VERSION: '17' | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | ||
|
||
jobs: | ||
verify-version: | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
version: ${{ steps.get_version.outputs.version }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set version | ||
id: get_version | ||
run: | | ||
VERSION=$(echo "${GITHUB_REF_NAME#v}" | tr -d '[:space:]') | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
- name: Check version.properties | ||
id: check_version | ||
run: | | ||
if [ ! -f "version.properties" ]; then | ||
echo "::error::version.properties file not found" | ||
exit 1 | ||
fi | ||
CURRENT_VERSION=$(grep -E "^[[:space:]]*version[[:space:]]*=[[:space:]]*[^[:space:]]" version.properties | head -n 1 | cut -d'=' -f2 | tr -d '[:space:]') | ||
if [ -z "$CURRENT_VERSION" ]; then | ||
echo "::error::No valid version found in version.properties" | ||
exit 1 | ||
fi | ||
echo "Current version from properties: '$CURRENT_VERSION'" | ||
echo "Version from tag: '${{ steps.get_version.outputs.version }}'" | ||
if [ "$CURRENT_VERSION" != "${{ steps.get_version.outputs.version }}" ]; then | ||
echo "::error::Version mismatch: version.properties ($CURRENT_VERSION) does not match tag (${{ steps.get_version.outputs.version }})" | ||
exit 1 | ||
fi | ||
echo "Version check passed: $CURRENT_VERSION" | ||
build-jar: | ||
needs: verify-version | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ env.JAVA_VERSION }} | ||
cache: 'gradle' | ||
|
||
- name: Make gradlew executable | ||
run: chmod +x ./gradlew | ||
|
||
- name: Build Processor JAR | ||
run: | | ||
./gradlew clean bootJar -Pversion=${{ needs.verify-version.outputs.version }} --stacktrace || { | ||
echo "Build failed. Checking logs..." | ||
find . -name "*.log" -type f -exec cat {} \; | ||
exit 1 | ||
} | ||
- name: Prepare distribution | ||
run: | | ||
cp "build/libs/thymelab-processor-${{ needs.verify-version.outputs.version }}.jar" ./ | ||
- name: Upload JAR artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jar | ||
path: thymelab-processor-${{ needs.verify-version.outputs.version }}.jar | ||
retention-days: 5 | ||
|
||
package-examples: | ||
needs: verify-version | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create examples archive | ||
run: | | ||
if [ ! -d "examples" ]; then | ||
echo "Examples directory not found" | ||
exit 1 | ||
fi | ||
zip -r "thymelab-examples-${{ needs.verify-version.outputs.version }}.zip" examples/ | ||
- name: Upload examples artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: examples | ||
path: thymelab-examples-*.zip | ||
retention-days: 5 | ||
|
||
create-release: | ||
needs: [verify-version, build-jar, package-examples] | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get Changes | ||
id: get_changes | ||
run: | | ||
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD) | ||
echo "Previous tag: $PREV_TAG" | ||
if [ -z "$PREV_TAG" ]; then | ||
CHANGES=$(git log --pretty=format:"- %s (%h)") | ||
elif [ "$PREV_TAG" = "${{ github.ref_name }}" ]; then | ||
CHANGES="No changes (first release or re-release)" | ||
else | ||
CHANGES=$(git log --pretty=format:"- %s (%h)" ${PREV_TAG}..HEAD) | ||
fi | ||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | ||
echo "changes<<$EOF" >> "$GITHUB_OUTPUT" | ||
echo "$CHANGES" >> "$GITHUB_OUTPUT" | ||
echo "$EOF" >> "$GITHUB_OUTPUT" | ||
- name: Download JAR artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: jar | ||
path: release-files | ||
|
||
- name: Download examples artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: examples | ||
path: release-files | ||
|
||
- name: List files | ||
run: ls -R | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ThymeLab ${{ github.ref_name }} | ||
body: | | ||
## ThymeLab ${{ github.ref_name }} | ||
### Downloads | ||
- **thymelab-processor-${{ needs.verify-version.outputs.version }}.jar**: Standalone processor JAR | ||
- **thymelab-examples-${{ needs.verify-version.outputs.version }}.zip**: Template examples and resources | ||
### Running the Processor | ||
Run the processor JAR with Java 17 or higher: | ||
```bash | ||
java -jar thymelab-processor-${{ needs.verify-version.outputs.version }}.jar \ | ||
-Dserver.port=8080 \ | ||
-Dlogging.level.com.github.thkwag.thymelab=INFO \ | ||
-Dwatch.directory.templates=/path/to/templates \ | ||
-Dwatch.directory.thymeleaf-data=/path/to/thymelab/data \ | ||
-Dwatch.directory.static=/path/to/static | ||
``` | ||
### Note | ||
The examples package contains template examples that can be used with ThymeLab Processor. | ||
For configuration options, please refer to the documentation. | ||
### What's Changed | ||
${{ steps.get_changes.outputs.changes }} | ||
files: | | ||
release-files/thymelab-processor-${{ needs.verify-version.outputs.version }}.jar | ||
release-files/thymelab-examples-${{ needs.verify-version.outputs.version }}.zip | ||
draft: false | ||
prerelease: false | ||
generate_release_notes: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,25 @@ | ||
# Gradle | ||
.gradle/ | ||
build/ | ||
dist/ | ||
|
||
# IDE | ||
.idea/ | ||
.vscode/ | ||
*.iml | ||
*.iws | ||
*.ipr | ||
|
||
# Node | ||
node_modules/ | ||
out/ | ||
|
||
# VS Code Extension | ||
*.vsix | ||
|
||
# Logs | ||
*.log | ||
|
||
# OS | ||
.DS_Store | ||
Thumbs.db |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 THK | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,25 @@ | ||
ThymeLab | ||
Copyright (c) 2024 THK | ||
|
||
This software is licensed under the MIT License. | ||
See the LICENSE file for the full license text. | ||
|
||
This software includes the following third-party components: | ||
|
||
Thymeleaf (https://www.thymeleaf.org) | ||
Licensed under Apache License 2.0 | ||
|
||
Spring Boot (https://spring.io/projects/spring-boot) | ||
Licensed under Apache License 2.0 | ||
|
||
FlatLaf (https://www.formdev.com/flatlaf/) | ||
Licensed under Apache License 2.0 | ||
|
||
JSON-java (https://github.com/stleary/JSON-java) | ||
Released into the Public Domain | ||
|
||
JAnsi (https://github.com/fusesource/jansi) | ||
Licensed under Apache License 2.0 | ||
|
||
ThymeLab logo icon (https://www.flaticon.com/free-icon/flask_11920002) | ||
Licensed by Flaticon |
Oops, something went wrong.