Skip to content

Commit fd0c51d

Browse files
committed
Initial repo structure
1 parent e5ff7ea commit fd0c51d

18 files changed

+1045
-1
lines changed

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Gradle wrapper scripts should always have LF line endings
5+
gradlew text eol=lf
6+
gradlew.bat text eol=crlf
7+
8+
# Binary files
9+
*.jar binary
10+
*.class binary
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
labels: bug
5+
---
6+
7+
## Describe the bug
8+
A clear and concise description of what the bug is.
9+
10+
## To Reproduce
11+
Steps to reproduce the behavior:
12+
1. Go to '...'
13+
2. Click on '...'
14+
3. Run command '...'
15+
4. See error
16+
17+
## Expected behavior
18+
A clear and concise description of what you expected to happen.
19+
20+
## Logs and crash reports
21+
- Attach `logs/latest.log` and any crash report from `crash-reports/`.
22+
- If relevant, include the OpenComputers program snippet you ran.
23+
24+
## Screenshots
25+
If applicable, add screenshots to help explain your problem.
26+
27+
## Environment
28+
- Simple Structure Scanner version:
29+
- Minecraft: 1.12.2
30+
- Forge:
31+
- Java: 8u__
32+
- OS: Windows/Linux/macOS (version)
33+
- Modpack (if any):
34+
35+
## Additional context
36+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: README
4+
url: https://github.com/Aedial/SuperMobTracker#readme
5+
about: Check the README for usage notes and component callbacks before filing an issue.
6+
- name: Development Guide
7+
url: https://github.com/Aedial/SuperMobTracker/blob/main/DEVELOPMENT.md
8+
about: Build instructions, dependency setup, and extending drivers.
9+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
labels: enhancement
5+
---
6+
7+
## Is your feature request related to a problem?
8+
A clear and concise description of what the problem is. Ex. "I'm always frustrated when ..."
9+
10+
## Describe the solution you'd like
11+
A clear and concise description of what you want to happen.
12+
13+
## Alternatives you've considered
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
## Affected components or scope
17+
-
18+
19+
## Additional context
20+
Add any other context, mockups, or code snippets here.
21+

.github/pull_request_template.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Summary
2+
Explain the motivation and context for this change.
3+
4+
## Type of change
5+
- [ ] Bug fix (non-breaking change that fixes an issue)
6+
- [ ] New feature (non-breaking change that adds functionality)
7+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8+
- [ ] Chore/Refactor (no functional changes)
9+
- [ ] Documentation update only
10+
11+
## Related issues
12+
Closes #
13+
14+
## What changed
15+
16+
-
17+
18+
## How to test
19+
Provide steps and any relevant commands.
20+
21+
```cmd
22+
rem From repo root
23+
gradle setupDecompWorkspace
24+
gradle build
25+
```
26+
27+
If this adds/changes runtime behavior, include a minimal OC program or steps to verify in-game.
28+
29+
## Checklist
30+
- [ ] I built the project locally with Java 8 using `gradle build`.
31+
- [ ] I updated documentation (README/DEVELOPMENT.md) as needed.
32+
- [ ] I followed the existing code style.
33+
- [ ] I did not include secrets or private data.
34+
- [ ] If touching `mcmod.info`, it remains valid and accurate.
35+
- [ ] I searched for existing PRs/issues that cover this change.
36+
37+
## Additional context
38+
Add any other context that reviewers should know.
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
# build_release_notes.sh
4+
# Generates release notes combining annotated tag message and CHANGELOG.md section.
5+
# Usage: build_release_notes.sh <tag> <repo_owner> <repo_name> <commit_sha> <github_server_url>
6+
# Outputs markdown to STDOUT.
7+
8+
TAG=${1:?tag required}
9+
REPO_OWNER=${2:?owner required}
10+
REPO_NAME=${3:?name required}
11+
TAG_COMMIT=${4:?commit sha required}
12+
GITHUB_SERVER_URL=${5:-https://github.com}
13+
14+
# Normalize versions (strip leading v)
15+
# VERSION_FULL keeps suffixes like -rc1, VERSION_CORE strips them
16+
VERSION_FULL=$(echo "$TAG" | sed -E 's/^v//')
17+
VERSION_CORE=$(echo "$VERSION_FULL" | sed -E 's/^([0-9]+(\.[0-9]+)*).*/\1/')
18+
19+
# Get tag message. Try annotated tag contents first, then fall back to the tagged commit message
20+
# but only if the tag actually exists. If the tag name doesn't resolve to a tag ref, do nothing.
21+
TAG_MESSAGE=""
22+
# Check whether the tag ref exists
23+
if git rev-parse --verify --quiet "refs/tags/${TAG}" >/dev/null 2>&1; then
24+
# Try annotated tag contents (works for annotated tags)
25+
TAG_MESSAGE=$(git for-each-ref --format='%(contents)' "refs/tags/${TAG}" 2>/dev/null || true)
26+
27+
# If empty, try to read tag object (cat-file) - may include annotation
28+
if [ -z "${TAG_MESSAGE}" ]; then
29+
TAG_MESSAGE=$(git cat-file -p "refs/tags/${TAG}" 2>/dev/null | sed -n '1,/^$/p' || true)
30+
fi
31+
32+
# If still empty, fall back to commit message of the tagged commit (works for lightweight tags)
33+
if [ -z "${TAG_MESSAGE}" ]; then
34+
if git rev-parse "${TAG}^{commit}" >/dev/null 2>&1; then
35+
TAG_MESSAGE=$(git show -s --format='%B' "${TAG}^{commit}" 2>/dev/null || true)
36+
else
37+
TAG_MESSAGE=$(git show -s --format='%B' "${TAG}" 2>/dev/null || true)
38+
fi
39+
fi
40+
else
41+
# Tag reference does not exist; leave tag message empty
42+
TAG_MESSAGE=""
43+
fi
44+
45+
# Remove potential trailing whitespace in tag message
46+
TAG_MESSAGE=$(printf '%s' "${TAG_MESSAGE}" | sed -E ':a; /\n$/ {N; ba}; s/[[:space:]]+$//')
47+
# Remove potential trailing whitespace in tag message
48+
TAG_MESSAGE=$(printf '%s' "${TAG_MESSAGE}" | sed -E ':a; /\n$/ {N; ba}; s/[[:space:]]+$//')
49+
50+
# Extract the section from CHANGELOG.md belonging to this version
51+
CHANGELOG_CONTENT=""
52+
if git show "${TAG_COMMIT}:CHANGELOG.md" > /tmp/CHANGELOG_ALL 2>/dev/null; then
53+
# Grab section starting after heading line matching version until next heading
54+
# Try full version first (e.g., 1.0.0-rc1), then fall back to core (e.g., 1.0.0)
55+
EXTRACTED=""
56+
for try_ver in "${VERSION_FULL}" "${VERSION_CORE}"; do
57+
EXTRACTED=$(awk -v ver="${try_ver}" '
58+
BEGIN{found=0}
59+
$0 ~ "^##[[:space:]]*\\[" ver "\\]" {found=1; next}
60+
found && $0 ~ "^##[[:space:]]*\\[" {exit}
61+
found {print}
62+
' /tmp/CHANGELOG_ALL)
63+
if [ -n "${EXTRACTED}" ]; then
64+
break
65+
fi
66+
done
67+
if [ -n "${EXTRACTED}" ]; then
68+
CHANGELOG_CONTENT="${EXTRACTED}"
69+
fi
70+
fi
71+
72+
# Filter to sections Added / Changed / Fixed / Security, keep their content blocks until next heading of same depth (### )
73+
if [ -n "${CHANGELOG_CONTENT}" ]; then
74+
FILTERED=$(awk '
75+
BEGIN{cur=""; keep=0}
76+
/^###[[:space:]]+Added/ {cur="Added"; keep=1; print; next}
77+
/^###[[:space:]]+Changed/ {cur="Changed"; keep=1; print; next}
78+
/^###[[:space:]]+Fixed/ {cur="Fixed"; keep=1; print; next}
79+
/^###[[:space:]]+Security/ {cur="Security"; keep=1; print; next}
80+
/^###/ {cur=""; keep=0}
81+
{if(keep){print}}
82+
' <<<"${CHANGELOG_CONTENT}")
83+
# If filtering yielded something non-empty use it, else keep original
84+
if [ -n "${FILTERED}" ]; then
85+
CHANGELOG_CONTENT="${FILTERED}"
86+
fi
87+
fi
88+
89+
# Trim leading/trailing blank lines
90+
trim_blank() { sed -E '/^[[:space:]]*$/{$d;}; 1{/^[[:space:]]*$/d;}' ; }
91+
CHANGELOG_CONTENT=$(printf '%s\n' "${CHANGELOG_CONTENT}" | sed -E ':a;/^$/{$d;N;ba};' | sed -E '1{/^$/d;}') || true
92+
93+
# Build compare link (try to determine a previous tag)
94+
COMPARE_LINK=""
95+
96+
# Try several ways to find a previous tag: by creation date, then by semantic/version sort,
97+
# then by using git describe on the parent commit. This improves chances of producing a
98+
# meaningful compare URL on repositories with different tag styles.
99+
PREV_TAG=""
100+
PREV_TAG=$(git tag --sort=-creatordate | grep -Fvx "${TAG}" | head -n1 || true)
101+
if [ -z "${PREV_TAG}" ]; then
102+
PREV_TAG=$(git tag --sort=-v:refname | grep -Fvx "${TAG}" | head -n1 || true)
103+
fi
104+
if [ -z "${PREV_TAG}" ]; then
105+
PREV_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || true)
106+
fi
107+
if [ -n "${PREV_TAG}" ]; then
108+
# Only build a compare URL if the requested TAG actually resolves to something the
109+
# git server can compare to: either a tag ref or a commit-ish.
110+
if git rev-parse --verify --quiet "refs/tags/${TAG}" >/dev/null 2>&1 || git rev-parse --verify --quiet "${TAG}" >/dev/null 2>&1; then
111+
COMPARE_URL="${GITHUB_SERVER_URL}/${REPO_OWNER}/${REPO_NAME}/compare/${PREV_TAG}...${TAG}"
112+
COMPARE_LINK="Full changelog: ${COMPARE_URL}"
113+
fi
114+
fi
115+
116+
# Assemble final notes without embedding literal \n sequences
117+
segments=()
118+
if [ -n "${TAG_MESSAGE}" ]; then
119+
segments+=("${TAG_MESSAGE}")
120+
fi
121+
if [ -n "${CHANGELOG_CONTENT}" ]; then
122+
segments+=("${CHANGELOG_CONTENT}")
123+
fi
124+
if [ -n "${COMPARE_LINK}" ]; then
125+
segments+=("${COMPARE_LINK}")
126+
fi
127+
128+
# Join segments with a blank line
129+
if [ ${#segments[@]} -gt 0 ]; then
130+
# Print each segment separated by a blank line
131+
{
132+
for i in "${!segments[@]}"; do
133+
printf '%s' "${segments[$i]}"
134+
if [ "$i" -lt $((${#segments[@]} - 1)) ]; then
135+
printf '\n\n'
136+
else
137+
printf '\n'
138+
fi
139+
done
140+
} | sed -E ':a;/^$/{$d;N;ba};' # trim trailing blank lines
141+
fi

.github/workflows/build.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: build
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
env:
14+
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
15+
CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 8
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: temurin
24+
java-version: '8'
25+
26+
- name: Cache Gradle and Forge/MCP
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/.gradle/caches
31+
~/.gradle/wrapper
32+
key: gradle-${{ runner.os }}-fg2_3-forge-1_12_2-14_23_5_2847-${{ hashFiles('**/*.gradle*', 'gradle/wrapper/gradle-wrapper.properties') }}
33+
restore-keys: |
34+
gradle-${{ runner.os }}-fg2_3-forge-1_12_2-14_23_5_2847-
35+
36+
- name: Make gradlew executable
37+
run: chmod +x gradlew
38+
39+
- name: Make scripts executable
40+
run: chmod +x .github/scripts/*.sh
41+
42+
- name: Build
43+
working-directory: .
44+
run: |
45+
./gradlew --version
46+
./gradlew setupCiWorkspace --info
47+
./gradlew build --info
48+
49+
- name: Upload artifact
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: simplestructurescanner-jar
53+
path: build/libs/*.jar
54+
55+
- name: Publish GitHub Release (tags only)
56+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
run: |
60+
TAG="${GITHUB_REF##*/}"
61+
TAG_COMMIT=$(git rev-list -n 1 "$TAG")
62+
NOTES_FILE="/tmp/release_notes.md"
63+
.github/scripts/build_release_notes.sh "$TAG" "${GITHUB_REPOSITORY%/*}" "${GITHUB_REPOSITORY#*/}" "$TAG_COMMIT" "${GITHUB_SERVER_URL:-https://github.com}" > "$NOTES_FILE"
64+
echo "Generated release notes:" >&2
65+
sed 's/^/ /' "$NOTES_FILE" >&2
66+
gh release create "$TAG" build/libs/*.jar \
67+
--title "Simple Structure Scanner $TAG" \
68+
--notes-file "$NOTES_FILE" \
69+
$(if [[ "$TAG" =~ [ab]|rc|pre ]]; then echo "--prerelease"; fi)
70+
71+
- name: Publish to CurseForge (tags only; infer release type)
72+
if: ${{ env.CURSEFORGE_TOKEN != '' && startsWith(github.ref, 'refs/tags/') }}
73+
working-directory: .
74+
env:
75+
CURSEFORGE_TOKEN: ${{ env.CURSEFORGE_TOKEN }}
76+
CURSEFORGE_PROJECT_ID: ${{ env.CURSEFORGE_PROJECT_ID }}
77+
GIT_TAG: ${{ github.ref_name }}
78+
CHANGELOG: ${{ github.event.head_commit.message }}
79+
run: |
80+
set -euo pipefail
81+
TAG="${GIT_TAG:-${GITHUB_REF##*/}}"
82+
LOWER=$(echo "$TAG" | tr '[:upper:]' '[:lower:]')
83+
RELEASE_TYPE=release
84+
if [[ "$LOWER" == *alpha* ]]; then
85+
RELEASE_TYPE=alpha
86+
elif [[ "$LOWER" == *beta* || "$LOWER" == *rc* || "$LOWER" == *pre* ]]; then
87+
RELEASE_TYPE=beta
88+
else
89+
CORE=$(echo "$LOWER" | sed -E 's/^v//')
90+
if [[ "$CORE" =~ ^[0-9]+(\.[0-9]+)*a([0-9]*)?$ ]]; then
91+
RELEASE_TYPE=alpha
92+
elif [[ "$CORE" =~ ^[0-9]+(\.[0-9]+)*b([0-9]*)?$ ]]; then
93+
RELEASE_TYPE=beta
94+
fi
95+
fi
96+
TAG_COMMIT=$(git rev-list -n 1 "$TAG")
97+
CL=$(.github/scripts/build_release_notes.sh "$TAG" "${GITHUB_REPOSITORY%/*}" "${GITHUB_REPOSITORY#*/}" "$TAG_COMMIT" "${GITHUB_SERVER_URL:-https://github.com}")
98+
./gradlew curseforge --no-daemon \
99+
-PcurseforgeProjectId="$CURSEFORGE_PROJECT_ID" \
100+
-PcurseforgeChangelog="$CL" \
101+
-PcurseforgeReleaseType="$RELEASE_TYPE"

0 commit comments

Comments
 (0)