diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a2e9575 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,174 @@ +name: Release + +# Builds every distribution of the game (Windows, Linux, macOS, web, Android APK). +# - push to development / manual run: builds are kept as workflow artifacts (7 days). +# - "Version bump" finished on main (a new version): the builds are attached to a GitHub +# release tagged vMAJOR.MINOR.PATCH. +# Needs the ANDROID_KEYSTORE_B64 secret (base64 of android.keystore) to sign the APK; without +# it the Android build is skipped. Never commit the keystore: losing or changing it means +# installed apps can no longer be updated. + +on: + workflow_run: + workflows: ["Version bump"] + types: [completed] + branches: [main] + push: + branches: [development] + workflow_dispatch: + inputs: + ref: + description: Branch, tag or commit to build + default: development + publish: + description: Publish a GitHub release for the VERSION found there + type: boolean + default: false + +permissions: + contents: write + +concurrency: + group: release-${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'push' }} + +env: + RENPY_VERSION: "8.5.3" + # Ren'Py runs headless on the runner. + SDL_VIDEODRIVER: dummy + SDL_AUDIODRIVER: dummy + RENPY_RENDERER: sw + +jobs: + build: + if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + timeout-minutes: 90 + outputs: + version: ${{ steps.version.outputs.version }} + sha: ${{ steps.version.outputs.sha }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_run' && 'main' || (inputs.ref || github.sha) }} + + - name: Version + id: version + run: | + echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" + echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + - uses: astral-sh/setup-uv@v5 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "21" # RAPT requires JDK 21 + + - name: Cache Ren'Py SDK, RAPT and Android SDK + id: sdk-cache + uses: actions/cache@v4 + with: + path: tools/renpy-sdk + key: renpy-sdk-${{ env.RENPY_VERSION }}-android-v1 + + - name: Install Ren'Py SDK and RAPT + if: steps.sdk-cache.outputs.cache-hit != 'true' + run: | + set -euo pipefail + mkdir -p tools/renpy-sdk + base="https://www.renpy.org/dl/${RENPY_VERSION}" + curl -fsSL "$base/renpy-${RENPY_VERSION}-sdk.tar.bz2" | tar -xj --strip-components=1 -C tools/renpy-sdk + curl -fsSL -o /tmp/rapt.zip "$base/renpy-${RENPY_VERSION}-rapt.zip" + unzip -q /tmp/rapt.zip -d tools/renpy-sdk + # Android SDK packages; this accepts Google's Android SDK licence for the build. + cd tools/renpy-sdk/rapt + ../lib/py3-linux-x86_64/python -c " + import runpy, sys + sys.path[:0] = ['..'] + sys.argv = ['android.py', 'installsdk'] + runpy.run_path('android.py', run_name='__main__') + " < <(yes y) + + - name: Generate the Ren'Py project + run: | + uv sync --locked + uv run vnpipe --work . renpy + + - name: Android signing key + id: android + env: + KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }} + run: | + if [ -z "$KEYSTORE_B64" ]; then + echo "::warning::ANDROID_KEYSTORE_B64 is not set; skipping the Android build." + echo "enabled=false" >> "$GITHUB_OUTPUT" + else + printf '%s' "$KEYSTORE_B64" | base64 -d > vn/android.keystore + cp vn/android.keystore vn/bundle.keystore + echo "enabled=true" >> "$GITHUB_OUTPUT" + fi + + - name: Build desktop and web packages + run: | + set -euo pipefail + sdk=tools/renpy-sdk + mkdir -p build/dist + "$sdk/renpy.sh" "$sdk/launcher" distribute vn --package win --package linux --package mac --destination build/dist + "$sdk/renpy.sh" "$sdk/launcher" web_build vn --destination build/web + rm -f vn/progressive_download.txt + + - name: Build the Android APK + if: steps.android.outputs.enabled == 'true' + run: | + sdk=tools/renpy-sdk + "$sdk/renpy.sh" "$sdk/launcher" android_build vn --destination build/dist + + - name: Name the files after the version + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + set -euo pipefail + mkdir -p release + pick() { ls build/dist/$1 2>/dev/null | head -n1; } + put() { [ -n "$1" ] && cp "$1" "release/faust-vn-v${VERSION}-$2"; } + put "$(pick '*-win.zip')" windows.zip + put "$(pick '*-linux.tar.bz2')" linux.tar.bz2 + put "$(pick '*-mac.zip')" macos.zip + put "$(pick '*.apk')" android.apk + cp build/web.zip "release/faust-vn-v${VERSION}-web.zip" + ls -lh release + + - uses: actions/upload-artifact@v4 + with: + name: faust-vn-v${{ steps.version.outputs.version }} + path: release/* + retention-days: 7 + compression-level: 0 + + publish: + needs: build + if: github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && inputs.publish) + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: faust-vn-v${{ needs.build.outputs.version }} + path: release + + - name: Create the release + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ needs.build.outputs.version }} + SHA: ${{ needs.build.outputs.sha }} + run: | + set -euo pipefail + tag="v${VERSION}" + if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then + echo "::notice::Release $tag already exists; nothing to do." + exit 0 + fi + gh release create "$tag" release/* \ + --repo "$GITHUB_REPOSITORY" \ + --target "$SHA" \ + --title "Fausto v${VERSION}" \ + --generate-notes diff --git a/.gitignore b/.gitignore index 38f79f7..5944401 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,9 @@ vn/game/audio/ # Generated by vnpipe: a copy of voice/clips/ vn/game/voice/ + +# Android signing keys (secret, never committed) and RAPT local state +vn/*.keystore +vn/local.properties +vn/bundle.properties +vn/.android.json diff --git a/CLAUDE.md b/CLAUDE.md index 77bdca0..4a0ceea 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,6 +34,9 @@ Faust I (Spanish, Llorente) as a Ren'Py visual novel. This repo is a *work*: the minor on a `development` -> `main` merge). Do not edit it by hand. - CI (`.github/workflows/ci.yml`) runs ruff and pytest; vnpipe is public and fetched over HTTPS. - `main` is the remote's default branch; `development` is only for ongoing work. +- Remote is GitHub `Dasemu/faust-vn` (SSH push needed for workflow changes, see `LESSONS.md`). + `.github/workflows/release.yml` builds win/linux/mac/web/APK and publishes a release per + new version on `main`; the APK keystore is the `ANDROID_KEYSTORE_B64` secret (`docs/running.md`). ## Layout `work.toml`, `data/`, `annotations/`, `assets/`, `voice/`, `vn/`, `tests/`, `docs/`; see `docs/plan.md`. diff --git a/LESSONS.md b/LESSONS.md index b644ca1..302d963 100644 --- a/LESSONS.md +++ b/LESSONS.md @@ -32,3 +32,8 @@ Recurring problems and what worked. Read before starting; add an entry when a mi full result in about 1 minute). - CI commits a VERSION bump to `development` after every push, so a later push is rejected: `git fetch` and merge `origin/development` before pushing again. +- GitHub remote is `Dasemu/faust-vn` (vnpipe: `Dasemu/vnpipe`). The `gh` OAuth token lacks the + `workflow` scope, so HTTPS pushes touching `.github/workflows` are rejected: push over SSH + (`git push git@github.com:Dasemu/.git `) or run `gh auth refresh -s workflow`. +- Accents in the checkout path (`Darío`) break the Android Gradle build (`local.properties` + is Latin-1, the keystore is "not found"). Build the APK from an ASCII-path copy of `vn/`. diff --git a/README.md b/README.md index 9b5223f..cbab805 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,8 @@ overrides, menu background) is in `work.toml`. Lint, tests and build instructions: [docs/running.md](docs/running.md). Plan and layout: [docs/plan.md](docs/plan.md). + +## Downloads + +Every release on GitHub (Releases page) ships the Android APK and the Windows, Linux, macOS and +web builds. See `docs/running.md` for building them locally. diff --git a/docs/running.md b/docs/running.md index 5d83e65..ecada4a 100644 --- a/docs/running.md +++ b/docs/running.md @@ -114,3 +114,30 @@ tools/renpy-sdk/renpy.sh tools/renpy-sdk/launcher distribute vn --package linux `--package` also accepts `win` and `mac`; omit it to build every package. The web build also leaves a `build/web.zip` next to the folder. A web build writes `vn/progressive_download.txt`; delete it (it is not part of the generated project). + +### Android APK + +One-time local setup: unpack `renpy-8.5.3-rapt.zip` into `tools/renpy-sdk/rapt`, use JDK 21 +(`JAVA_HOME`), and install the Android SDK with RAPT's `android.py installsdk` (this accepts +Google's Android SDK licence). The `[android]` table in `work.toml` makes `vnpipe renpy` write +`vn/android.json`, the icons and the presplash. + +```sh +tools/renpy-sdk/renpy.sh tools/renpy-sdk/launcher android_build vn --destination build/dist +``` + +- Signing: copy the release keystore to `vn/android.keystore` and `vn/bundle.keystore` (alias + `android`, password `android`; both are gitignored). Always sign with the **same** keystore: + a different one cannot update an installed app. Keep a private backup; never commit it. +- The project path must be ASCII (Gradle's `local.properties` is Latin-1): from a path with + accents such as `Darío`, build from a copy of `vn/` in an ASCII directory. + +## 6. Releases (CI) + +`.github/workflows/release.yml` builds Windows, Linux, macOS, web and the signed APK. +- Push to `development` or a manual run: builds are kept as workflow artifacts (7 days). +- Merge `development` into `main`: `version.yml` bumps the version, then `release.yml` + publishes the GitHub release `vMAJOR.MINOR.PATCH` with all five files. +- The APK needs the `ANDROID_KEYSTORE_B64` repository secret + (`base64 -w0 android.keystore | gh secret set ANDROID_KEYSTORE_B64`); without it the + Android build is skipped. diff --git a/pyproject.toml b/pyproject.toml index f1be253..e6491a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ package = false # vnpipe is pinned through uv.lock. After pushing vnpipe changes: `uv lock --upgrade-package vnpipe`. # To try an unpushed vnpipe checkout: `uv run --with-editable ../vnpipe `. [tool.uv.sources] -vnpipe = { git = "https://git.zenvairo.es/dasemu/vnpipe.git", branch = "development" } +vnpipe = { git = "https://github.com/Dasemu/vnpipe.git", branch = "development" } [tool.ruff] line-length = 100 diff --git a/uv.lock b/uv.lock index 081ed19..03f165b 100644 --- a/uv.lock +++ b/uv.lock @@ -35,7 +35,7 @@ dev = [ ] [package.metadata] -requires-dist = [{ name = "vnpipe", git = "https://git.zenvairo.es/dasemu/vnpipe.git?branch=development" }] +requires-dist = [{ name = "vnpipe", git = "https://github.com/Dasemu/vnpipe.git?branch=development" }] [package.metadata.requires-dev] dev = [ @@ -357,7 +357,7 @@ wheels = [ [[package]] name = "vnpipe" version = "0.1.0" -source = { git = "https://git.zenvairo.es/dasemu/vnpipe.git?branch=development#d1bcdf3340c27d8e1b79135f1dcce9cddfe9efd1" } +source = { git = "https://github.com/Dasemu/vnpipe.git?branch=development#c50e2a3a628b3b7d315f6b8c79e92dc86dfd0755" } dependencies = [ { name = "jsonschema" }, { name = "pillow" }, diff --git a/vn/android-icon_background.png b/vn/android-icon_background.png new file mode 100644 index 0000000..eb4b589 Binary files /dev/null and b/vn/android-icon_background.png differ diff --git a/vn/android-icon_foreground.png b/vn/android-icon_foreground.png new file mode 100644 index 0000000..f4bd66a Binary files /dev/null and b/vn/android-icon_foreground.png differ diff --git a/vn/android-presplash.jpg b/vn/android-presplash.jpg new file mode 100644 index 0000000..48efaca Binary files /dev/null and b/vn/android-presplash.jpg differ diff --git a/vn/android.json b/vn/android.json new file mode 100644 index 0000000..b49fd76 --- /dev/null +++ b/vn/android.json @@ -0,0 +1,21 @@ +{ + "expansion": false, + "google_play_key": null, + "google_play_salt": null, + "heap_size": null, + "icon_name": "Fausto", + "include_pil": false, + "include_sqlite": false, + "layout": null, + "name": "Fausto", + "numeric_version": 1, + "orientation": "sensorLandscape", + "package": "io.github.dasemu.faust", + "permissions": [], + "source": false, + "store": "none", + "update_always": true, + "update_icons": true, + "update_keystores": true, + "version": "1.0" +} \ No newline at end of file diff --git a/work.toml b/work.toml index cf79abb..958f7df 100644 --- a/work.toml +++ b/work.toml @@ -1629,3 +1629,11 @@ dream_figures = "Dream Figures" # Other strings this work defines (art style labels of assets/assets.json). [translations.en.strings] "Pictórico" = "Painterly" + +# Android APK inputs for RAPT (vnpipe writes android.json, icon and presplash). +[android] +package = "io.github.dasemu.faust" +name = "Fausto" +icon = "assets/sprites/painterly/faust_neutral.webp" +icon_background = "#14110e" +presplash = "assets/bg/painterly/study.webp"