Repository navigation
Publish a signed APT repository to GitHub Pages on release #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
neph1
wants to merge
1
commit into
jMonkeyEngine:master
Choose a base branch
from
neph1:push_to_apt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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 |
This file contains hidden or 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
This file contains hidden or 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,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" | ||
| 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!" | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 chosestableas the suite name? Often, it's common to usestableormaindepending 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?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!