Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/actions/publish-apt-repo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Publish APT repository"
description: "Builds a signed APT repository from the .deb installers and deploys it to GitHub Pages"

inputs:
tag:
required: true
description: "Tag should be used for releases"

runs:
using: "composite"
steps:
- name: Install dpkg tooling
run: sudo apt-get update && sudo apt-get install -y dpkg-dev apt-utils
shell: bash

- name: Download installers
uses: actions/download-artifact@v8
with:
pattern: installers-Linux-*
path: release-assets
merge-multiple: true

- name: Collect .deb files
run: |
mkdir -p dist/installers
find release-assets -name '*.deb' -exec cp {} dist/installers/ \;
ls -la dist/installers
shell: bash

- name: Build and sign APT repository
run: bash installers/publish-apt-repo.sh
env:
APT_REPO_GPG_PRIVATE_KEY: ${{ secrets.APT_REPO_GPG_PRIVATE_KEY }}
APT_REPO_GPG_PASSPHRASE: ${{ secrets.APT_REPO_GPG_PASSPHRASE }}
shell: bash

- name: Upload APT repository
uses: actions/upload-artifact@v7
with:
name: apt-repo
path: dist/apt-repo/
compression-level: 9

- name: Export public key
uses: actions/upload-artifact@v7
with:
name: apt-repo-key
path: dist/apt-repo/jmonkeyengine-repo.asc

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: dist/pages

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
25 changes: 24 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,30 @@ jobs:
arch: ${{ runner.arch }}

# -------------------------------
# 3. Release
# 3. APT repository (GitHub Pages)
# -------------------------------
apt-repo:
needs: package
runs-on: ubuntu-latest

environment:
name: github-pages

permissions:
contents: read
pages: write
id-token: write

steps:
- uses: actions/checkout@v6

- name: Publish APT repository
uses: ./.github/actions/publish-apt-repo
with:
tag: ${{ github.ref }}

# -------------------------------
# 4. Release
# -------------------------------
release:
needs: package
Expand Down
83 changes: 83 additions & 0 deletions installers/publish-apt-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash
#(c) jmonkeyengine.org

# Turns the .deb installers produced by build-installers.sh into a signed APT
# repository and publishes it to the GitHub Pages site of this repository.
#
# Prerequisites:
# - .deb files must exist in <repo-root>/dist/installers (downloaded from the
# installers-* release artifacts)
# - secrets APT_REPO_GPG_PRIVATE_KEY and APT_REPO_GPG_PASSPHRASE must be set
# (see .github/actions/publish-apt-repo/action.yml)
# - the `pages` environment on the repo must allow deployment from this workflow

set -e # Quit on Error

repo_root="$(cd "$(dirname "$0")/.." && pwd)"
input_dir="$repo_root/dist/installers"
out_dir="$repo_root/dist/apt-repo"
suite="stable"
component="main"
key_name="jMonkeyEngine APT Repository"
key_email="contact@jmonkeyengine.org"

if [ -z "$APT_REPO_GPG_PRIVATE_KEY" ]; then
echo "APT_REPO_GPG_PRIVATE_KEY secret is not set, cannot sign the repository. ERROR!!!"
exit 1
fi

debs=$(find "$input_dir" -maxdepth 1 -name '*.deb' | sort)
if [ -z "$debs" ]; then
echo "No .deb files found in $input_dir. ERROR!!!"
exit 1
fi

echo ">> Building APT repository in $out_dir"
rm -rf "$out_dir"
mkdir -p "$out_dir/pool/$component" "$out_dir/dists/$suite/$component"

for deb in $debs; do
cp "$deb" "$out_dir/pool/$component/"
done

archs=$(for deb in $debs; do dpkg-deb -f "$deb" Architecture; done | sort -u | tr '\n' ' ')
echo ">> Architectures: $archs"

for arch in $archs; do
arch_dir="$out_dir/dists/$suite/$component/binary-$arch"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Using an APT repository is a fantastic improvement for Debian/Ubuntu users.

One quick question regarding installers/publish-apt-repo.sh: Is there a reason you chose stable as the suite name? Often, it's common to use stable or main depending on the project's release model, but I wanted to make sure this aligns with the team's plans for distribution. Also, have you verified if the repository path handles potential future versions (e.g., testing, unstable) gracefully, or are we intentionally keeping it simple for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to only release stable versions to apt. We mostly do stable releases, anyway.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes total sense! Keeping it focused on stable releases is super clean and fits the workflow well. Thanks for clarifying!

mkdir -p "$arch_dir"
(cd "$out_dir" && dpkg-scanpackages --arch "$arch" "pool/$component" /dev/null > "dists/$suite/$component/binary-$arch/Packages")
gzip -9kf "$arch_dir/Packages"
done

apt-ftparchive \
-o APT::FTPArchive::Release::Origin="jMonkeyEngine" \
-o APT::FTPArchive::Release::Label="jMonkeyEngine" \
-o APT::FTPArchive::Release::Suite="$suite" \
-o APT::FTPArchive::Release::Codename="$suite" \
-o APT::FTPArchive::Release::Architectures="$archs" \
-o APT::FTPArchive::Release::Components="$component" \
-o APT::FTPArchive::Release::Description="jMonkeyEngine SDK APT repository" \
release "$out_dir/dists/$suite" > "$out_dir/dists/$suite/Release"

echo ">> Importing signing key"
export GNUPGHOME="$(mktemp -d)"
trap 'rm -rf "$GNUPGHOME"' EXIT
echo "$APT_REPO_GPG_PRIVATE_KEY" | gpg --batch --import
gpg --list-secret-keys

echo ">> Signing Release file"
gpg --batch --yes --pinentry-mode loopback --passphrase "$APT_REPO_GPG_PASSPHRASE" \
--local-user "$key_email" --armor --detach-sign \
-o "$out_dir/dists/$suite/Release.gpg" "$out_dir/dists/$suite/Release"
gpg --batch --yes --pinentry-mode loopback --passphrase "$APT_REPO_GPG_PASSPHRASE" \
--local-user "$key_email" --clearsign \
-o "$out_dir/dists/$suite/InRelease" "$out_dir/dists/$suite/Release"

gpg --batch --yes --armor --export "$key_email" > "$out_dir/jmonkeyengine-repo.asc"

echo ">> Publishing to GitHub Pages"
mkdir -p "$repo_root/dist/pages"
cp -r "$out_dir/." "$repo_root/dist/pages/"

echo "< OK!"
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ There are multiple files from which you can choose:
You can take the platform agnostic `jmonkeyplatform.zip` which contains the full SDK able to be run on "any" (64-bit) platform (Windows, Mac OS, Linux) however it lacks the JDK.
Thus the prefered download is `jmonkeyplatform-windows-x64.exe` which essentially __is__ `jmonkeyplatform.zip` and the correct version of the JDK.

On Debian/Ubuntu Linux you can also install the SDK directly via APT from our signed repository (amd64 and arm64):
```sh
curl -fsSL https://jmonkeyengine.github.io/sdk/jmonkeyengine-repo.asc | sudo gpg --dearmor -o /usr/share/keyrings/jmonkeyengine.gpg
echo "deb [signed-by=/usr/share/keyrings/jmonkeyengine.gpg] https://jmonkeyengine.github.io/sdk stable main" | sudo tee /etc/apt/sources.list.d/jmonkeyengine.list
sudo apt update && sudo apt install jmonkeyengine-sdk
```

After the SDK is up and running. A good starting point is to look at the jME examples. Under *File | New project | JME3 Tests* you can create a new project, populated with the jME build in examples. You can freely mess around with these and try out stuff. Your changes can always be reverted by simply creating a new *JME3 Tests* project. Once you are all comfortable and ready to embark on your own exciting journey, *File | New project | Basic game (with Gradle)* is the recommended starting point.

## Building the SDK
Expand Down
Loading