Skip to content

Commit f029855

Browse files
committed
Add Maven and GitHub Actions CI/CD
1 parent 4389d3d commit f029855

3 files changed

Lines changed: 143 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Java CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
build:
13+
name: Build and Test
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
cache: maven
26+
27+
- name: Build with Maven
28+
run: mvn clean package -DskipTests
29+
30+
- name: Upload build artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: tictactoe-jar
34+
path: target/TicTacToe-*.jar
35+
retention-days: 30
36+
37+
release:
38+
name: Create Release with JAR
39+
needs: build
40+
runs-on: ubuntu-latest
41+
if: github.event_name == 'release'
42+
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Set up JDK 17
48+
uses: actions/setup-java@v4
49+
with:
50+
java-version: '17'
51+
distribution: 'temurin'
52+
cache: maven
53+
54+
- name: Build with Maven
55+
run: mvn clean package -DskipTests
56+
57+
- name: Upload Release Assets
58+
uses: softprops/action-gh-release@v2
59+
with:
60+
files: target/TicTacToe-*.jar
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+

.idea/copilot.data.migration.ask2agent.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>de.marvin</groupId>
8+
<artifactId>tictactoe</artifactId>
9+
<version>1.0.0</version>
10+
<packaging>jar</packaging>
11+
12+
<name>TicTacToe</name>
13+
<description>Ein Tic-Tac-Toe Spiel mit KI-Gegnern</description>
14+
15+
<properties>
16+
<maven.compiler.source>17</maven.compiler.source>
17+
<maven.compiler.target>17</maven.compiler.target>
18+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19+
</properties>
20+
21+
<build>
22+
<plugins>
23+
<!-- Java Compiler -->
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-compiler-plugin</artifactId>
27+
<version>3.10.1</version>
28+
<configuration>
29+
<source>17</source>
30+
<target>17</target>
31+
</configuration>
32+
</plugin>
33+
34+
<!-- JAR mit Main-Class -->
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-jar-plugin</artifactId>
38+
<version>3.2.2</version>
39+
<configuration>
40+
<archive>
41+
<manifest>
42+
<mainClass>TicTacToe</mainClass>
43+
</manifest>
44+
</archive>
45+
<finalName>TicTacToe</finalName>
46+
</configuration>
47+
</plugin>
48+
49+
<!-- Shade Plugin für Uber-JAR (optional, für selbstständiges JAR) -->
50+
<plugin>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-shade-plugin</artifactId>
53+
<version>3.4.1</version>
54+
<executions>
55+
<execution>
56+
<phase>package</phase>
57+
<goals>
58+
<goal>shade</goal>
59+
</goals>
60+
<configuration>
61+
<transformers>
62+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
63+
<mainClass>TicTacToe</mainClass>
64+
</transformer>
65+
</transformers>
66+
<finalName>TicTacToe-${project.version}</finalName>
67+
</configuration>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
</project>
74+

0 commit comments

Comments
 (0)