Skip to content

Commit b574c6c

Browse files
committed
Create objects.zip on CI and auto create release
1 parent ca92c16 commit b574c6c

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,22 @@ jobs:
2626
else
2727
exit 1
2828
fi
29+
build-objects:
30+
name: Build objects
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v3
35+
- name: Create objects.zip
36+
run: ./package
37+
- name: Upload artifacts
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: "OpenRCT2 Objects"
41+
path: artifacts/objects.zip
42+
- name: Create release
43+
uses: softprops/action-gh-release@v1
44+
if: startsWith(github.ref, 'refs/tags/v')
45+
with:
46+
fail_on_unmatched_files: true
47+
files: artifacts/objects.zip

package

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -e
3+
4+
outDir="artifacts/objects"
5+
6+
echo -e "\033[0;36mRe-creating artifacts directory...\033[0m"
7+
rm -rf "artifacts"
8+
mkdir -p "$outDir"
9+
10+
echo -e "\033[0;36mCopying objects...\033[0m"
11+
pushd objects > /dev/null
12+
cp -r "official" "rct1" "rct2" "rct2ww" "rct2tt" "../$outDir"
13+
popd > /dev/null
14+
15+
echo -e "\033[0;36mCreating .parkobj files...\033[0m"
16+
for i in $(find "$outDir" -type d);
17+
do
18+
objectFile="$i/object.json"
19+
if [ -f "$objectFile" ]; then
20+
objName=$(basename "$i")
21+
src=$i
22+
dst="$src.parkobj"
23+
echo " $objName.parkobj"
24+
pushd "$src" > /dev/null
25+
zip -qr9 "../$objName.parkobj" *
26+
popd > /dev/null
27+
rm -rf "$src"
28+
fi
29+
done;
30+
31+
echo -e "\033[0;36mCreating final archive...\033[0m"
32+
pushd "$outDir" > /dev/null
33+
zip -qr9 "../objects.zip" *
34+
popd > /dev/null
35+
rm -rf "$outDir"

0 commit comments

Comments
 (0)