generated from o7-Fire/Mindustry-Mods-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (105 loc) · 4.45 KB
/
gradle.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
name: Java CI
on:
push:
workflow_dispatch:
jobs:
Build-Release:
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Gradle Validation
uses: gradle/[email protected]
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
#when you don't
- name: Change wrapper permissions
run: chmod +x ./gradlew
# Cache Gradle dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Write Dependency
run: ./gradlew desktop:writeDependency
#Build all mods
- name: Build bootstrapper jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: ./gradlew deploy -PgithubRepo="$GITHUB_REPOSITORY"
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
| tr '\r\n' ' ' \
| jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' \
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
#cat eqv
- name: Read changelog
id: manifest
uses: juliangruber/read-file-action@v1
with:
path: ./Changelog.md
- name: Read Version
id: version
uses: juliangruber/read-file-action@v1
with:
path: ./Version
# Create new release draft - which is not publicly visible and requires manual acceptance
- name: Create Release Draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
#write it by yourself, not worth automating it
tag_name: "Snapshot"
release_name: "${{ steps.version.outputs.content }}"
body: "${{ steps.manifest.outputs.content }}"
draft: true
#upload to release
- name: Upload Dex Jar Bootstrapper
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: ./build/libs/Mindustry-Glopion-Dexed.jar
asset_name: dexed-Mindustry-Glopion.jar
asset_content_type: application/zip
#upload to release
- name: Upload Dex Jar Core
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: ./core/build/libs/core-Dexed.jar
asset_name: Mindustry-Glopion-Core.jar
asset_content_type: application/zip
#upload to release
- name: Upload Jar DeepPatch
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: ./desktop/build/libs/desktop.jar
asset_name: Mindustry-Glopion-DeepPatch.jar
asset_content_type: application/zip