Skip to content

Commit ba2b2f3

Browse files
committed
Create maven-publish.yml
1 parent fbe14a3 commit ba2b2f3

3 files changed

Lines changed: 66 additions & 7 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3+
4+
name: Maven Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '11'
24+
distribution: 'temurin'
25+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26+
settings-path: ${{ github.workspace }} # location for the settings.xml file
27+
28+
- name: Build with Maven
29+
run: mvn -B package --file pom.xml
30+
31+
- name: Publish to GitHub Packages Apache Maven
32+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/maven.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
name: Java CI
22

33
on:
4-
push:
4+
push:
55
branches:
66
- master
7-
pull_request:
7+
pull_request:
88
branches:
99
- master
1010

1111
jobs:
12-
build:
13-
12+
build:
1413
name: Maven build
1514
runs-on: ubuntu-latest
1615

@@ -34,4 +33,30 @@ jobs:
3433
restore-keys: ${{ runner.os }}-m2
3534

3635
- name: Build with Maven
37-
run: mvn package --file pom.xml
36+
run: mvn install --file pom.xml
37+
38+
- name: Generate Unix Timestamp
39+
id: timestamp
40+
run: echo "UNIX_TIMESTAMP=$(date +%s)" >> $GITHUB_ENV
41+
42+
- name: Create Release
43+
id: create_release
44+
uses: actions/create-release@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
47+
with:
48+
tag_name: ${{ env.UNIX_TIMESTAMP }}
49+
release_name: 'nightly snapshot'
50+
draft: false
51+
prerelease: false
52+
53+
- name: Upload Release Asset
54+
id: upload-release-asset
55+
uses: actions/upload-release-asset@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
upload_url: ${{ steps.create_release.outputs.upload_url }}
60+
asset_path: ./target/InfinityExpansion vMODIFIED.jar
61+
asset_name: InfinityExpansion.jar
62+
asset_content_type: application/java-archive

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<dependency>
4141
<groupId>com.github.Slimefun</groupId>
4242
<artifactId>Slimefun4</artifactId>
43-
<version>934ab822a6</version>
43+
<version>RC-35</version>
4444
<scope>provided</scope>
4545
</dependency>
4646

@@ -142,4 +142,4 @@
142142
</plugin>
143143
</plugins>
144144
</build>
145-
</project>
145+
</project>

0 commit comments

Comments
 (0)