Skip to content
Merged
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
25 changes: 20 additions & 5 deletions .github/workflows/release-egg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Release egg

# Publishes egg-nginx-webhost.json as a GitHub release named after the EGG_VERSION in its
# install script (e.g. v1.0.0). Bump EGG_VERSION to make a new release.
# The egg is attached twice: egg-nginx-webhost-<version>.json to download, and
# egg-nginx-webhost.json, which servers' update checks fetch from the latest release.
on:
push:
branches: [main]
Expand Down Expand Up @@ -47,17 +49,27 @@ jobs:
TAG: v${{ steps.egg.outputs.version }}
REPUBLISH: ${{ inputs.republish }}
run: |
name="egg-nginx-webhost-${TAG#v}.json"
versioned="${RUNNER_TEMP}/${name}"
cp egg-nginx-webhost.json "${versioned}"

if [ "$(gh release view "${TAG}" --json isDraft --jq .isDraft 2>/dev/null)" = "false" ]; then
gh release download "${TAG}" --pattern egg-nginx-webhost.json --output "${RUNNER_TEMP}/released.json"
if cmp -s egg-nginx-webhost.json "${RUNNER_TEMP}/released.json"; then
echo "Release ${TAG} already exists with this egg, nothing to do."
# Releases made before the versioned file existed get it added
if gh release view "${TAG}" --json assets --jq '.assets[].name' | grep -qxF "${name}"; then
echo "Release ${TAG} already exists with this egg, nothing to do."
else
gh release upload "${TAG}" "${versioned}"
echo "Added ${name} to release ${TAG}."
fi
exit 0
fi
if [ "${REPUBLISH}" = "true" ]; then
# Run by hand with "republish": swap the egg in the existing release. The tag
# stays where it is, release tags are protected and can't be moved
gh release upload "${TAG}" egg-nginx-webhost.json --clobber
echo "Replaced egg-nginx-webhost.json in release ${TAG}."
gh release upload "${TAG}" egg-nginx-webhost.json "${versioned}" --clobber
echo "Replaced the egg in release ${TAG}."
exit 0
fi
echo "::error::egg-nginx-webhost.json changed but EGG_VERSION is still ${TAG#v}. Bump EGG_VERSION, or run this workflow by hand with \"republish\" ticked to replace the egg in ${TAG}."
Expand All @@ -66,16 +78,19 @@ jobs:
cat > notes.md <<'EOF'
## Install

1. Download `egg-nginx-webhost.json` below.
1. Download `EGG_FILE` below.
2. In the panel: **Admin → Nests → Import Egg**, upload it.
3. Create a server with the egg, pick a PHP version (Docker Image), and visit `http://ip:port`.

## Update from an older version

**Admin → Nests → (nest) → Nginx Webhost → Update Egg** with this file (not Import Egg, that makes a second copy), then **Reinstall** your servers.
Reinstalling replaces `nginx/`, `php-fpm/` and `start.sh` on each server (`webroot/` is kept), so back up any edits to them first.

`egg-nginx-webhost.json` is the same file, kept for the servers' update check.
EOF
gh release create "${TAG}" egg-nginx-webhost.json \
sed -i "s/EGG_FILE/${name}/" notes.md
gh release create "${TAG}" "${versioned}" egg-nginx-webhost.json \
--title "${TAG}" \
--notes-file notes.md \
--target "${GITHUB_SHA}"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ A [Pterodactyl](https://pterodactyl.io) egg for hosting PHP and static websites

## Install

1. Download [`egg-nginx-webhost.json`](https://github.com/Rustix-Development/pterodactyl-nginx-egg/releases/latest/download/egg-nginx-webhost.json)
from the [latest release](https://github.com/Rustix-Development/pterodactyl-nginx-egg/releases/latest).
1. Download `egg-nginx-webhost-<version>.json` from the
[latest release](https://github.com/Rustix-Development/pterodactyl-nginx-egg/releases/latest).
2. In the panel: **Admin → Nests → Import Egg**, upload it into the nest you want.
3. Create a server with the egg and pick a PHP version under **Docker Image**.
4. Once it has installed, start it and visit `http://<node-ip>:<port>`. You should see the
Expand Down Expand Up @@ -154,7 +154,7 @@ only into an empty `webroot/`. Your other website files are kept.

Every time a server starts it checks for updates in the background and says in the console if:

- **the egg has an update**: download `egg-nginx-webhost.json` from the
- **the egg has an update**: download `egg-nginx-webhost-<version>.json` from the
[latest release](https://github.com/Rustix-Development/pterodactyl-nginx-egg/releases/latest), then
**Admin → Nests → (nest) → Nginx Webhost → Update Egg** with it (not *Import Egg*, that
makes a second copy), and **Reinstall** the server.
Expand Down
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ check_egg_update() {
log_success "Egg is up to date (v${installed})."
else
log_update "Egg update available: ${installed:+v${installed} -> }v${latest}"
log_update " 1. Download egg-nginx-webhost.json from https://github.com/${EGG_REPO}/releases/latest"
log_update " 1. Download egg-nginx-webhost-${latest}.json from https://github.com/${EGG_REPO}/releases/latest"
log_update " and upload it in the panel: Admin -> Nests -> (nest) -> Nginx Webhost -> Update Egg"
log_update " 2. This server: Settings -> Reinstall Server. webroot is kept; nginx/, php-fpm/ and start.sh are replaced, so back up any edits to them first."
fi
Expand Down
Loading