-
-
Notifications
You must be signed in to change notification settings - Fork 26
153 lines (131 loc) · 4.84 KB
/
manual_build_dev_release.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
# This workflow will build the Mod with Gradle and cache/restore any dependencies to improve the workflow execution time
# Note: cache writing only happens on the default branch but child branches do have read access to the default branch
name: Manually Build Dev Release
on:
workflow_dispatch:
jobs:
cache_oxipng:
name: Cache Oxipng
runs-on: ubuntu-latest
steps:
- name: Cargo Install Oxipng
uses: baptiste0928/cargo-install@v2 #provides cache-efficient Rust crates installation
with:
crate: oxipng
env:
CARGO_TERM_COLOR: always
build_test:
name: Gradle Build Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup/Cache Gradle
uses: gradle/gradle-build-action@v2
- name: Test Asset Generation
uses: gradle/gradle-build-action@v2
with:
arguments: runData
- name: Test Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
changelog:
name: Generate Changelog
needs: [ build_test, cache_oxipng ]
runs-on: ubuntu-latest
outputs:
skip_build: ${{ steps.set_outputs.outputs.skipped }}
tag: ${{ steps.set_outputs.outputs.tag }}
clean_changelog: ${{ steps.set_outputs.outputs.changelog }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Get Minecraft Version
id: gradle_properties
uses: christian-draeger/[email protected]
with:
path: './gradle.properties'
properties: 'minecraft_version'
- name: Generate Conventional Changelog #this also determines the release version
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
preset: 'conventionalcommits'
github-token: ${{ secrets.GITHUB_TOKEN }}
version-file: './mod_version.json'
version-path: 'semantic'
git-message: 'chore(release): {version}'
tag-prefix: '${{ steps.gradle_properties.outputs.minecraft_version }}-v2.'
create-summary: true
- name: Set Outputs
id: set_outputs
run: |
echo "skipped=${{ steps.changelog.outputs.skipped }}" >> "$GITHUB_OUTPUT"
echo "tag=${{ steps.changelog.outputs.tag }}" >> "$GITHUB_OUTPUT"
{
echo 'changelog<<EOF'
echo "${{ steps.changelog.outputs.clean_changelog }}"
echo EOF
} >> "$GITHUB_OUTPUT"
build_release:
name: Build Release
needs: [ changelog ]
if: needs.changelog.outputs.skip_build == 'false'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ needs.changelog.outputs.tag }}
- name: Setup Oxipng
uses: baptiste0928/cargo-install@v2 #provides cache-efficient Rust crates installation
with:
crate: oxipng
env:
CARGO_TERM_COLOR: always
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Generate Assets
uses: gradle/gradle-build-action@v2
with:
arguments: runData
# We store assets at full raw quality in the repository and only optimize them for the release build
- name: Optimize PNG Assets
run: |
oxipng -o 3 -i 0 --strip safe -r ./src/*/resources/*.png
oxipng -o 3 -i 0 --strip safe -r ./src/*/resources/assets/*/textures
env:
CARGO_TERM_COLOR: always
- name: Build Artifact
uses: gradle/gradle-build-action@v2
with:
arguments: build
# ----------------------------------------------------------------------------------------------------------------
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.changelog.outputs.tag }}
body: ${{ needs.changelog.outputs.clean_changelog }}
files: build/libs/*
prerelease: true
- name: Notify Discord Server
uses: appleboy/[email protected]
with:
webhook_id: ${{ secrets.DISCORD_ID }}
webhook_token: ${{ secrets.DISCORD_TOKEN }}
color: "#088c7d"
username: "Maykr Bot"
message: "**:package: ${{ needs.changelog.outputs.tag }}**\n\n**Download**\n${{ fromJSON(steps.create_release.outputs.assets)[1].browser_download_url }}\n\n**Changelog**\n${{ steps.create_release.outputs.url }}"