-
Notifications
You must be signed in to change notification settings - Fork 4
178 lines (157 loc) · 5.88 KB
/
info.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
name: Project Info
run-name: "Project Info #${{ github.run_number }}"
env:
RELEASE_TYPE: "release"
MINECRAFT_VERSION: "1.12.2"
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
info:
name: 🖥️ Project Info
runs-on: ubuntu-latest
outputs:
project_version: ${{ steps.project_version.outputs.tag }}
project_name: ${{ steps.project_name.outputs.value }}
project_full_name: ${{ steps.project_name.outputs.value }}-${{ steps.project_version.outputs.tag }}
changelog: ${{ steps.changelog.outputs.description }}
diff: ${{ steps.read_diff.outputs.diff }}
release_type: ${{ env.RELEASE_TYPE }}
minecraft_version: ${{ env.MINECRAFT_VERSION }}
exists: ${{ steps.check_tag.outputs.exists }}
steps:
- name: 📁 Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: 🔍 Check pakku-lock.json
id: check_pakku_lock
shell: bash
run: |
if [ ! -f pakku-lock.json ]; then
echo "❌ Could not find pakku-lock.json" && exit 1
else
echo "✔️ pakku-lock.json"
fi
- name: 🔍 Check pakku.json
id: check_pakku
shell: bash
run: |
if [ ! -f pakku.json ]; then
echo "❌ Could not find pakku.json" && exit 1
else
echo "✔️ pakku.json"
fi
- name: 📈 Get latest tag
id: get_latest_tag
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
if [ -z "$tag" ]; then
echo "❌ Latest tag not found" && exit 1
else
echo "✔️ Latest tag found: $tag"
echo "tag=$tag" >> $GITHUB_OUTPUT
fi
- name: 🔍 Check pakku-lock.json in previous tag
id: check_pakku_lock_prev
shell: bash
run: |
if ! git ls-tree -r ${{ steps.get_latest_tag.outputs.tag }} -- ./pakku-lock.json &> /dev/null; then
echo "❌ File pakku-lock.json not found in previous tag" && exit 1
else
echo "✔️ File pakku-lock.json found in previous tag"
fi
- name: 📁 Copy pakku-lock.json from previous tag
id: copy_pakku_lock_prev
shell: bash
run: |
git show tags/${{ steps.get_latest_tag.outputs.tag }}:./pakku-lock.json > ./pakku-lock-prev.json
if [ -s ./pakku-lock-prev.json ]; then
echo "✔️ File pakku-lock-prev.json created"
else
echo "❌ Error: File pakku-lock-prev.json is empty or not created" && exit 1
fi
- name: 📦 Download pakku.jar
id: download_pakku
shell: bash
run: |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
echo "✔️ Downloaded pakku.jar "
- name: 🔄 Run pakku diff
id: run_pakku_diff
shell: bash
run: |
java -jar pakku.jar diff -v --markdown PROJECTS_DIFF.md ./pakku-lock-prev.json ./pakku-lock.json
if [ -f PROJECTS_DIFF.md ]; then
echo "✔️ Comparison completed"
else
echo "❌ Error: File PROJECTS_DIFF.md not created" && exit 1
fi
- name: 📝 Read PROJECTS_DIFF.md to variable
id: read_diff
shell: bash
run: |
echo "📝 Reading PROJECTS_DIFF.md to variable..."
{
echo 'diff<<EOF'
cat -v PROJECTS_DIFF.md
echo EOF
} >> "$GITHUB_OUTPUT"
echo "✔️ Diff content read to variable"
- name: 📊 Get Project Name
id: project_name
uses: ActionsTools/[email protected]
with:
file_path: "pakku.json"
prop_path: "name"
- name: 📊 Get Project Version
id: project_version
uses: ActionsTools/[email protected]
with:
file_path: "pakku.json"
prop_path: "version"
- name: 📄 Changelog Parser
id: changelog
uses: coditory/[email protected]
with:
path: CHANGELOG.md
- name: 📈 Upload Diff
id: diff
if: ${{ steps.read_diff.outputs.diff != '' }}
uses: actions/[email protected]
with:
name: Mods-diff
path: PROJECTS_DIFF.md
- name: 🔍 Check if tag exists
uses: mukunku/[email protected]
id: check_tag
with:
tag: ${{ steps.project_version.outputs.value }}
- name: 📝 Generate Github Summary
run: |
echo "📃 **Name**: ${{ steps.project_name.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Release**: ${{ steps.project_version.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Release Type**: ${{ env.RELEASE_TYPE }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Game Version**: ${{ env.MINECRAFT_VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.changelog.outputs.description }}" >> $GITHUB_STEP_SUMMARY
if [ -n "${{ steps.read_diff.outputs.diff != '' }}" ]; then
echo "${{ steps.read_diff.outputs.diff }}" >> $GITHUB_STEP_SUMMARY
fi
build:
needs: [info]
if: needs.info.outputs.exists != 'true'
uses: ./.github/workflows/build.yml
with:
project_version: ${{ needs.info.outputs.project_version }}
project_name: ${{ needs.info.outputs.project_name }}
project_full_name: ${{ needs.info.outputs.project_full_name }}
changelog: ${{ needs.info.outputs.changelog }}
diff: ${{ needs.info.outputs.diff }}
release_type: ${{ needs.info.outputs.release_type }}
minecraft_version: ${{ needs.info.outputs.minecraft_version }}
secrets: inherit