File tree Expand file tree Collapse file tree 7 files changed +102
-19
lines changed Expand file tree Collapse file tree 7 files changed +102
-19
lines changed Original file line number Diff line number Diff line change
1
+ name : Check deployed package
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ branches :
7
+ - main
8
+ - ' feat/package-auto-check-script'
9
+ pull_request :
10
+ branches :
11
+ - main
12
+ - ' feat/package-auto-check-script'
13
+
14
+ jobs :
15
+ check-deployed-package :
16
+ name : Check deployed package
17
+ runs-on : ubuntu-latest
18
+ permissions :
19
+ contents : read
20
+ packages : read
21
+
22
+ steps :
23
+ - name : Checkout repository
24
+ uses : actions/checkout@v4
25
+
26
+ - name : Set up Docker Buildx
27
+ uses : docker/setup-buildx-action@v3
28
+
29
+ - name : Make run script executable
30
+ run : chmod +x check-deployed-package/run.sh
31
+
32
+ - name : Run LogDash demo
33
+ env :
34
+ LOGDASH_API_KEY : ${{ secrets.LOGDASH_API_KEY }}
35
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36
+ GITHUB_ACTOR : ${{ github.actor }}
37
+ run : ./check-deployed-package/run.sh
Original file line number Diff line number Diff line change 1
1
FROM eclipse-temurin:17-jdk
2
2
3
+ ARG GITHUB_TOKEN
4
+ ARG GITHUB_ACTOR
5
+
3
6
WORKDIR /app
4
7
5
8
# Install Maven
6
9
RUN apt-get update && apt-get install -y maven && rm -rf /var/lib/apt/lists/*
7
10
8
- # Copy pom.xml and source files
11
+ # Copy Maven settings
12
+ COPY check-deployed-package/settings.xml /root/.m2/settings.xml
13
+
14
+ # Copy project files
9
15
COPY check-deployed-package/pom.xml .
10
16
COPY check-deployed-package/Check.java src/main/java/com/logdash/check/Check.java
11
17
12
- # Download dependencies and compile
13
- RUN mvn compile
18
+ # Set environment variables for Maven settings.xml
19
+ ENV GITHUB_TOKEN=${GITHUB_TOKEN}
20
+ ENV GITHUB_ACTOR=${GITHUB_ACTOR}
21
+
22
+ # Copy and make executable startup script
23
+ COPY check-deployed-package/start.sh /app/start.sh
24
+ RUN chmod +x /app/start.sh
14
25
15
- CMD ["mvn" , "exec:java" ]
26
+ CMD ["/app/start.sh" ]
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ Use command below to test if the published SDK works:
5
5
```
6
6
LOGDASH_API_KEY=<your-api-key> ./check-deployed-package/run.sh
7
7
```
8
+
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
- xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0
5
- https://maven.apache.org/xsd/maven-4.0.0.xsd" >
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
6
3
<modelVersion >4.0.0</modelVersion >
7
4
<groupId >com.logdash</groupId >
8
5
<artifactId >check</artifactId >
12
9
<maven .compiler.target>17</maven .compiler.target>
13
10
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
14
11
</properties >
15
-
16
- <repositories >
17
- <repository >
18
- <id >github</id >
19
- <name >GitHub Packages</name >
20
- <url >https://maven.pkg.github.com/logdash-io/java-sdk</url >
21
- </repository >
22
- </repositories >
23
-
12
+
24
13
<dependencies >
25
14
<dependency >
26
15
<groupId >io.logdash</groupId >
27
16
<artifactId >logdash</artifactId >
28
17
<version >0.1.0</version >
29
18
</dependency >
30
19
</dependencies >
20
+
21
+ <repositories >
22
+ <repository >
23
+ <id >github</id >
24
+ <name >GitHub Packages</name >
25
+ <url >https://maven.pkg.github.com/logdash-io/java-sdk</url >
26
+ </repository >
27
+ </repositories >
28
+
31
29
<build >
32
30
<plugins >
33
31
<plugin >
49
47
</plugin >
50
48
</plugins >
51
49
</build >
52
- </project >
50
+ </project >
Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ METRICS_SEED=$(awk 'BEGIN{srand(); print int(rand()*1000000)+1}')
10
10
echo " Generated metrics seed: $METRICS_SEED "
11
11
12
12
echo " Building LogDash Java demo Docker image (using published package)..."
13
- docker build --no-cache -t logdash-java-demo -f check-deployed-package/Dockerfile .
13
+ docker build --no-cache \
14
+ --build-arg GITHUB_TOKEN=" ${GITHUB_TOKEN} " \
15
+ --build-arg GITHUB_ACTOR=" ${GITHUB_ACTOR} " \
16
+ -t logdash-java-demo \
17
+ -f check-deployed-package/Dockerfile .
14
18
15
19
echo
16
20
echo " Running LogDash Java demo..."
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <settings xmlns =" http://maven.apache.org/SETTINGS/1.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/SETTINGS/1.0.0
5
+ https://maven.apache.org/xsd/settings-1.0.0.xsd" >
6
+ <servers >
7
+ <server >
8
+ <id >github</id >
9
+ <username >${env.GITHUB_ACTOR}</username >
10
+ <password >${env.GITHUB_TOKEN}</password >
11
+ </server >
12
+ </servers >
13
+
14
+ <profiles >
15
+ <profile >
16
+ <id >github-auth</id >
17
+ <activation >
18
+ <property >
19
+ <name >env.GITHUB_TOKEN</name >
20
+ </property >
21
+ </activation >
22
+ </profile >
23
+ </profiles >
24
+ </settings >
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -e
3
+
4
+ echo " Compiling with Maven..."
5
+ mvn compile -B --no-transfer-progress
6
+
7
+ echo " Running application..."
8
+ mvn exec:java
You can’t perform that action at this time.
0 commit comments