forked from ufosc/VisualNovel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Build Bytes of Love | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
renpy-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Extract short commit hash | ||
shell: bash | ||
run: echo "git_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT | ||
id: ref | ||
|
||
- name: Setup Ren'Py and Build | ||
run: | | ||
wget https://www.renpy.org/dl/8.3.2/renpy-8.3.2-sdk.tar.bz2 | ||
tar -xf renpy-8.3.2-sdk.tar.bz2 | ||
( cd renpy-8.3.2-sdk && ./renpy.sh launcher distribute ../BytesOfLove --destination ../dist --package win --package mac --package linux ) | ||
- name: Process Files | ||
run: python .github/workflows/process.py ${{ steps.ref.outputs.git_hash }} | ||
|
||
- name: Upload Linux Build | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: BytesOfLove-linux-${{ steps.ref.outputs.git_hash }} | ||
path: dist/BytesOfLove-linux-${{ steps.ref.outputs.git_hash }}.tar.bz2 | ||
compression-level: 0 | ||
|
||
- name: Upload Mac Build | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: BytesOfLove-mac-${{ steps.ref.outputs.git_hash }} | ||
path: dist/BytesOfLove-mac-${{ steps.ref.outputs.git_hash }}.zip | ||
compression-level: 0 | ||
|
||
- name: Upload Windows Build | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: BytesOfLove-win-${{ steps.ref.outputs.git_hash }} | ||
path: dist/BytesOfLove-win-${{ steps.ref.outputs.git_hash }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import sys | ||
from pathlib import Path | ||
from zipfile import ZipFile | ||
|
||
commit_hash = sys.argv[1] | ||
|
||
files = Path("dist").glob('*') | ||
|
||
for a_file in files: | ||
if not a_file.is_file(): | ||
continue | ||
|
||
if a_file.suffix == ".zip": | ||
platform = a_file.stem.split("-")[-1].removesuffix(".zip") | ||
|
||
if platform == "win": | ||
print("Extracting", a_file) | ||
with ZipFile(a_file, 'r') as zip_ref: | ||
zip_ref.extractall(f"dist/BytesOfLove-{platform}-{commit_hash}") | ||
print("Extracted", a_file) | ||
else: | ||
# due to https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss, | ||
# we don't want to extract the file in the fears of losing certain permissions | ||
# windows doesn't care though | ||
print("Renaming", a_file) | ||
a_file.rename(f"dist/BytesOfLove-{platform}-{commit_hash}.zip") | ||
|
||
elif a_file.suffix == ".bz2": | ||
# see above | ||
print("Renaming", a_file) | ||
a_file.rename("dist/BytesOfLove-linux-" + commit_hash + ".tar.bz2") |