Skip to content

Commit d9205ae

Browse files
PythiaUFJMalegni
authored andcommitted
ci: create build ci for push/prs
1 parent 63e8c18 commit d9205ae

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build Bytes of Love
2+
on:
3+
- push
4+
- pull_request
5+
6+
jobs:
7+
renpy-build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
13+
- name: Setup Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.12'
17+
18+
- name: Extract short commit hash
19+
shell: bash
20+
run: echo "git_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
21+
id: ref
22+
23+
- name: Setup Ren'Py and Build
24+
run: |
25+
wget https://www.renpy.org/dl/8.3.2/renpy-8.3.2-sdk.tar.bz2
26+
tar -xf renpy-8.3.2-sdk.tar.bz2
27+
( cd renpy-8.3.2-sdk && ./renpy.sh launcher distribute ../BytesOfLove --destination ../dist --package win --package mac --package linux )
28+
29+
- name: Process Files
30+
run: python .github/workflows/process.py ${{ steps.ref.outputs.git_hash }}
31+
32+
- name: Upload Linux Build
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: BytesOfLove-linux-${{ steps.ref.outputs.git_hash }}
36+
path: dist/BytesOfLove-linux-${{ steps.ref.outputs.git_hash }}.tar.bz2
37+
compression-level: 0
38+
39+
- name: Upload Mac Build
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: BytesOfLove-mac-${{ steps.ref.outputs.git_hash }}
43+
path: dist/BytesOfLove-mac-${{ steps.ref.outputs.git_hash }}.zip
44+
compression-level: 0
45+
46+
- name: Upload Windows Build
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: BytesOfLove-win-${{ steps.ref.outputs.git_hash }}
50+
path: dist/BytesOfLove-win-${{ steps.ref.outputs.git_hash }}

.github/workflows/process.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
from pathlib import Path
3+
from zipfile import ZipFile
4+
5+
commit_hash = sys.argv[1]
6+
7+
files = Path("dist").glob('*')
8+
9+
for a_file in files:
10+
if not a_file.is_file():
11+
continue
12+
13+
if a_file.suffix == ".zip":
14+
platform = a_file.stem.split("-")[-1].removesuffix(".zip")
15+
16+
if platform == "win":
17+
print("Extracting", a_file)
18+
with ZipFile(a_file, 'r') as zip_ref:
19+
zip_ref.extractall(f"dist/BytesOfLove-{platform}-{commit_hash}")
20+
print("Extracted", a_file)
21+
else:
22+
# due to https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss,
23+
# we don't want to extract the file in the fears of losing certain permissions
24+
# windows doesn't care though
25+
print("Renaming", a_file)
26+
a_file.rename(f"dist/BytesOfLove-{platform}-{commit_hash}.zip")
27+
28+
elif a_file.suffix == ".bz2":
29+
# see above
30+
print("Renaming", a_file)
31+
a_file.rename("dist/BytesOfLove-linux-" + commit_hash + ".tar.bz2")

0 commit comments

Comments
 (0)