-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (182 loc) · 6.37 KB
/
build.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Master Build
'on':
push:
branches:
- master
jobs:
bump:
runs-on: ubuntu-latest
outputs:
version: '${{ steps.bump.outputs.version }}'
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v2
- name: Bump Version
id: bump
uses: Plugily-Projects/version-bump-action@v6
with:
github-token: '${{ secrets.github_token }}'
git-username: Maven-Version-Bot
auto-version-bump: true
- name: Print Version
run: 'echo ''New Version: ${{steps.bump.outputs.version}}'''
build:
needs: bump
outputs:
version: '${{ needs.bump.outputs.version }}'
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v3
with:
ref: master
- name: Set up JDK 19
uses: actions/setup-java@v1
with:
java-version: 19
- name: Build with Maven
run: 'mvn -B clean:clean package --file pom.xml'
- run: mvn --batch-mode --update-snapshots verify
- uses: actions/upload-artifact@v2
with:
name: jar
path: target/*.jar
release:
if: 'contains(github.event.head_commit.message, ''#'')'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
id: download
with:
name: jar
- name: Display structure of downloaded files
run: ls -R
# - uses: marvinpinto/action-automatic-releases@latest
# with:
# repo_token: '${{ secrets.GITHUB_TOKEN }}'
# automatic_release_tag: '${{ needs.build.outputs.version }}'
# prerelease: false
# title: 'Version: ${{ needs.build.outputs.version }}'
# files: |
# **/*.jar
# README.md
- name: Build Changelog
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print Changelog
run: 'echo ''Changelog: ${{steps.build_changelog.outputs.changelog}}'''
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: '${{ needs.build.outputs.version }}'
release_name: 'Version: ${{ needs.build.outputs.version }}'
body: '${{steps.build_changelog.outputs.changelog}}'
draft: false
prerelease: false
- name: Upload Release Asset JAR
id: upload-release-asset-jar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./uno-engine-${{ needs.build.outputs.version }}.jar
asset_name: uno-engine-${{ needs.build.outputs.version }}.jar
asset_content_type: application/java-archive
- name: Upload Release Asset MD
id: upload-release-asset-md
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./README.md
asset_name: README.md
asset_content_type: text/markdown
upload:
runs-on: ubuntu-latest
needs: release
if: false
steps:
- uses: actions/download-artifact@v2
id: download
with:
name: jar
- name: Glob match
uses: tj-actions/glob@v16
id: glob
with:
files: |
*.jar
- name: Show all matching files
run: |
echo "${{ steps.glob.outputs.paths }}"
- name: Rename Jar
run: mv ${{ steps.glob.outputs.paths }} MinecraftEmergency.jar
- name: Publish to pterodactyl
uses: Avenze/pterodactyl-actions@master
with:
panel: '${{ secrets.PANEL }}'
api_key: '${{ secrets.API_KEY }}'
server: '${{ secrets.SERVER }}'
path: 'MinecraftEmergency.jar'
directory: /plugins
- name: Pterodactyl Power Action
uses: outsparkled/pterodactyl-power-action@v0.1.0
with:
panel-url: '${{ secrets.PANEL }}'
server-id: '${{ secrets.SERVER }}'
bearer-token: '${{ secrets.API_KEY }}'
power-action: restart
prerelease:
needs: build
if: '!contains(github.event.head_commit.message, ''#'')'
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v3
- uses: actions/download-artifact@v2
id: download
with:
name: jar
- name: Display structure of downloaded files
run: ls -R
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
automatic_release_tag: latest
prerelease: true
title: Development Build
files: |
**/MinecraftEmergency-*.jar
README.md
mvnRelease:
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Latest Commit
uses: actions/checkout@v3
with:
ref: master
- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}