-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.4 KB
/
main.yml
File metadata and controls
55 lines (46 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Java CI with Maven
on:
push:
branches: ["main"]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 24
uses: actions/setup-java@v4
with:
java-version: "24"
distribution: temurin
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Locate Jar File
id: locate_jar
run: |
# Find the jar file in the target directory
jar_path=$(find target -maxdepth 1 -type f -name '*.jar')
echo "Jar file found: ${jar_path}"
echo "JAR_PATH=${jar_path}" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.JAR_PATH }}
asset_name: template.jar
asset_content_type: application/java-archive