Initial template: release pipeline + PORTING.md + init helper
What lands in any repo created from this template: - .gitea/workflows/release.yml — canonical Gitea-Actions release pipeline (tag-triggered, curl-based publish, per-asset failure tolerance) - tools/build_zip.sh — git-archive per addon folder, multi-addon bundle - tools/init_from_upstream.sh — one-shot squash-import of upstream tree into <AddonFolder>/ at the repo root - PORTING.md — full CoA-compat bug-pattern checklist (Retail-only globals, FileDataIDs, hardcoded class lists, StaticPopup race, .tga textures, Minimap mask, CLEU arg positions, Ace3 sweep, etc.) - README.md — quick-start backport guide - standard .gitignore (incl dist/) + .gitattributes (* -text)
This commit is contained in:
Executable
+99
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
# init_from_upstream.sh — bootstrap a new Exiles addon fork from upstream.
|
||||
#
|
||||
# Usage:
|
||||
# tools/init_from_upstream.sh <upstream-url> <AddonFolderName> [upstream-branch]
|
||||
#
|
||||
# Example:
|
||||
# tools/init_from_upstream.sh https://github.com/Ascension-Addons/CallToArms CallToArms
|
||||
#
|
||||
# What it does:
|
||||
# 1. Adds `upstream` remote and fetches it.
|
||||
# 2. Squash-imports the upstream tree at the named branch (default master/main)
|
||||
# into <AddonFolderName>/ at the repo root.
|
||||
# 3. Leaves you with a single staged commit you review and finalise.
|
||||
#
|
||||
# What it does NOT do:
|
||||
# - Push anything.
|
||||
# - Tag anything.
|
||||
# - Modify the upstream history (it's a squash import, not a merge).
|
||||
#
|
||||
# After running, verify with:
|
||||
# bash tools/build_zip.sh
|
||||
# unzip -l dist/<AddonFolderName>.zip | head -5
|
||||
# then `git commit --amend` if you want to edit the message, push,
|
||||
# and tag <upstream-version>-coa.1 to trigger the first release.
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
|
||||
echo "usage: $0 <upstream-url> <AddonFolderName> [upstream-branch]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
upstream_url=$1
|
||||
folder=$2
|
||||
branch=${3:-}
|
||||
|
||||
if [ -d "$folder" ]; then
|
||||
echo "refusing to overwrite existing folder $folder/" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! git remote get-url upstream >/dev/null 2>&1; then
|
||||
git remote add upstream "$upstream_url"
|
||||
else
|
||||
git remote set-url upstream "$upstream_url"
|
||||
fi
|
||||
|
||||
echo "==> fetching upstream"
|
||||
git fetch --tags upstream
|
||||
|
||||
if [ -z "$branch" ]; then
|
||||
# Try master, then main.
|
||||
if git rev-parse --verify "upstream/master" >/dev/null 2>&1; then
|
||||
branch=master
|
||||
elif git rev-parse --verify "upstream/main" >/dev/null 2>&1; then
|
||||
branch=main
|
||||
else
|
||||
echo "couldn't find upstream/master or upstream/main; pass branch explicitly" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "==> importing tree from upstream/$branch into $folder/"
|
||||
|
||||
# Extract upstream tree into a temporary worktree-like dir, then move into folder.
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
git archive "upstream/$branch" | tar -x -C "$tmp"
|
||||
mkdir -p "$folder"
|
||||
# rsync preserves dotfiles; --exclude keeps obvious noise out.
|
||||
rsync -a --exclude '.git/' --exclude '.github/' --exclude '.gitea/' \
|
||||
--exclude '.idea/' --exclude '.vscode/' --exclude '.DS_Store' \
|
||||
"$tmp"/ "$folder"/
|
||||
|
||||
git add "$folder"
|
||||
upstream_sha=$(git rev-parse "upstream/$branch")
|
||||
upstream_short=$(git rev-parse --short "upstream/$branch")
|
||||
git commit -m "Import $folder from upstream@$upstream_short
|
||||
|
||||
upstream: $upstream_url
|
||||
branch: $branch
|
||||
commit: $upstream_sha"
|
||||
|
||||
cat <<EOF
|
||||
|
||||
==> done. next steps:
|
||||
1. bash tools/build_zip.sh
|
||||
2. unzip -l dist/$folder.zip | head -5
|
||||
(expect first entry: $folder/)
|
||||
3. git push origin master
|
||||
4. Read $folder/$folder.toc — look for the version string.
|
||||
Tag with <upstream-version>-coa.1, e.g.:
|
||||
git tag -a 1.2.3-coa.1 -m "first Exiles release"
|
||||
git push origin 1.2.3-coa.1
|
||||
The release workflow picks it up and publishes
|
||||
https://git.sub-net.at/Exiles/<this-repo>/releases/tag/<tag>.
|
||||
|
||||
The upstream remote stays configured so future rebases / re-imports
|
||||
are one-line: \`git fetch upstream && ...\`.
|
||||
EOF
|
||||
Reference in New Issue
Block a user