forked from retromcorg/Project-Poseidon
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
31 changed files
with
679 additions
and
170 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,39 @@ | ||
name: Java-Compatibility | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# Java 8 is tested as a part of the build-and-test workflow | ||
java-version: ['17', '21' ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Java ${{ matrix.java-version }} | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ matrix.java-version }} | ||
distribution: temurin | ||
java-package: jdk | ||
|
||
- name: Set up Maven | ||
uses: stCarolas/[email protected] | ||
with: | ||
maven-version: 3.9.1 | ||
|
||
- name: Build application | ||
shell: bash | ||
run: | | ||
mvn clean install |
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,97 @@ | ||
name: Release Workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up JDK 1.8 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 8 | ||
|
||
# Step 3: Get the version from pom.xml | ||
- name: Get the version from pom.xml | ||
id: get_version | ||
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | ||
|
||
# Step 4: Fail if snapshot version | ||
- name: Fail if snapshot version | ||
run: | | ||
if [[ $PROJECT_VERSION == *"-SNAPSHOT"* ]]; then | ||
echo "Snapshot versions are not releasable" | ||
exit 0 | ||
fi | ||
# Step 5: Generate custom release version | ||
- name: Generate Release Version | ||
id: release_version | ||
run: | | ||
DATE=$(date +'%y%m%d-%H%M') | ||
SHA=$(echo $GITHUB_SHA | cut -c1-7) | ||
RELEASE_VERSION="${PROJECT_VERSION}-${DATE}-${SHA}" | ||
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | ||
# Step 6: Create version.properties file | ||
- name: Create version.properties file | ||
run: | | ||
mkdir -p src/main/resources | ||
# Application Information | ||
APP_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout) | ||
# Core Metadata | ||
echo "version=${{ env.RELEASE_VERSION }}" >> src/main/resources/version.properties | ||
echo "build_timestamp=$(date --utc +'%Y-%m-%dT%H:%M:%SZ')" >> src/main/resources/version.properties | ||
echo "git_branch=${{ github.ref_name }}" >> src/main/resources/version.properties | ||
echo "git_commit=${GITHUB_SHA}" >> src/main/resources/version.properties | ||
echo "app_name=${APP_NAME}" >> src/main/resources/version.properties | ||
echo "release_version=${{ env.RELEASE_VERSION }}" >> src/main/resources/version.properties | ||
echo "maven_version=${{ env.PROJECT_VERSION }}" >> src/main/resources/version.properties | ||
# Build Type | ||
if [[ "${{ github.ref }}" == "refs/heads/master" || "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
BUILD_TYPE="production" | ||
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
BUILD_TYPE="pull_request" | ||
else | ||
BUILD_TYPE="development" | ||
fi | ||
echo "build_type=${BUILD_TYPE}" >> src/main/resources/version.properties | ||
# CI/CD Metadata | ||
echo "workflow_name=${{ github.workflow }}" >> src/main/resources/version.properties | ||
echo "workflow_run_id=${{ github.run_id }}" >> src/main/resources/version.properties | ||
echo "workflow_run_number=${{ github.run_number }}" >> src/main/resources/version.properties | ||
# Team or Author Information | ||
echo "build_author=${{ github.actor }}" >> src/main/resources/version.properties | ||
# Step 7: Build with Maven | ||
- name: Build with Maven | ||
run: mvn clean package | ||
|
||
# Step 8: Create GitHub Release | ||
- name: Create GitHub Release | ||
if: ${{ !endsWith(env.PROJECT_VERSION, '-SNAPSHOT') }} | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.RELEASE_VERSION }} | ||
name: ${{ env.RELEASE_VERSION }} | ||
files: | | ||
target/*.jar | ||
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
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
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
Oops, something went wrong.