-
Notifications
You must be signed in to change notification settings - Fork 47
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
vsc1cob
committed
Jan 20, 2025
1 parent
7846da7
commit ceaf502
Showing
11 changed files
with
88 additions
and
68 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
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,7 @@ | ||
name: Cache Maven dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- |
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,6 @@ | ||
name: Display Artifact Download Link | ||
run: | | ||
ARTIFACT_NAME="${{ github.repository }}-${{ github.ref_name }}-${{ github.sha }}.jar" # Artifact name based on repo and branch | ||
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/artifacts/${{ github.run_id }}/download/${ARTIFACT_NAME}" | ||
echo "You can download the artifact from the following link:" | ||
echo $ARTIFACT_URL |
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,6 @@ | ||
name: Display IP Address and Port | ||
run: | | ||
echo "Fetching the runner's IP address..." | ||
IP_ADDRESS=$(curl -s ifconfig.me) # This fetches the public IP of the runner | ||
PORT=8080 | ||
echo "The app is accessible at: http://$IP_ADDRESS:$PORT" |
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,2 @@ | ||
name: Build with Maven | ||
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,2 @@ | ||
name: Run Spring Boot App | ||
run: mvn spring-boot:run & |
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,5 @@ | ||
name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' |
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,4 @@ | ||
name: Gracefully Stop Spring Boot App | ||
run: | | ||
echo "Stopping the app gracefully..." | ||
mvn spring-boot:stop |
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,6 @@ | ||
name: Upload Artifacts with Versioning | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ github.repository }}-${{ github.ref_name }}-${{ github.sha }} # Artifact name based on repo and branch (replacing / with -) | ||
path: target/*.jar # Path to the built artifact (e.g., JAR file or other build outputs) | ||
|
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,12 @@ | ||
name: Validate App is Running | ||
run: | | ||
echo "Checking if the app is running..." | ||
IP_ADDRESS=$(curl -s ifconfig.me) # Fetch public IP address | ||
PORT=8080 | ||
RESPONSE=$(curl --write-out "%{http_code}" --silent --output /dev/null http://$IP_ADDRESS:$PORT) | ||
if [ "$RESPONSE" -eq 200 ]; then | ||
echo "The app is running successfully at http://$IP_ADDRESS:$PORT!" | ||
else | ||
echo "The app failed to start. HTTP response code: $RESPONSE" | ||
exit 1 | ||
fi |
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,4 @@ | ||
name: Wait for 3 minutes | ||
run: | | ||
echo "App has been running for 3 minutes. Waiting..." | ||
sleep 180 # Wait for 3 minutes |