-
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (55 loc) · 1.83 KB
/
Maven-BuildAndRealese.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
name: Build and Release Minecraft Plugin - Maven
on:
push:
tags:
- "v*" # Trigger the workflow on new version tags
workflow_dispatch: # Allows manual triggering
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4 # Updated to v4
- name: Set up Java
uses: actions/setup-java@v4 # Updated to v4
with:
distribution: 'temurin' # Use Temurin JDK (formerly AdoptOpenJDK)
java-version: '17' # Set your desired Java version here
- name: Build with Maven
run: mvn clean package
- name: Archive built jar
uses: actions/upload-artifact@v4 # Updated to v4
with:
name: minecraft-plugin
path: target/*.jar
release:
needs: build
runs-on: ubuntu-latest
if: github.ref_type == 'tag' # Only run on tags (i.e., version releases)
steps:
- name: Checkout code
uses: actions/checkout@v4 # Updated to v4
- name: Set up Java
uses: actions/setup-java@v4 # Updated to v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build with Maven
run: mvn clean package
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload plugin jar to release
uses: actions/upload-release-asset@v2 # Updated to v2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/*.jar
asset_name: minecraft-plugin.jar
asset_content_type: application/java-archive