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
146 changes: 5 additions & 141 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: [ main ]
branches: [main]
pull_request:

jobs:
Expand All @@ -22,144 +22,8 @@ jobs:

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.19.4
path: versions/1.19.4/build/libs/anarchymod-mc-1.19.4-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.20
path: versions/1.20/build/libs/anarchymod-mc-1.20-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.20.1
path: versions/1.20.1/build/libs/anarchymod-mc-1.20.1-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.20.2
path: versions/1.20.2/build/libs/anarchymod-mc-1.20.2-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.20.3
path: versions/1.20.3/build/libs/anarchymod-mc-1.20.3-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.20.4
path: versions/1.20.4/build/libs/anarchymod-mc-1.20.4-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.20.5
path: versions/1.20.5/build/libs/anarchymod-mc-1.20.5-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.20.6
path: versions/1.20.6/build/libs/anarchymod-mc-1.20.6-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21
path: versions/1.21/build/libs/anarchymod-mc-1.21-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.1
path: versions/1.21.1/build/libs/anarchymod-mc-1.21.1-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.2
path: versions/1.21.2/build/libs/anarchymod-mc-1.21.2-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.3
path: versions/1.21.3/build/libs/anarchymod-mc-1.21.3-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.4
path: versions/1.21.4/build/libs/anarchymod-mc-1.21.4-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.5
path: versions/1.21.5/build/libs/anarchymod-mc-1.21.5-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.6
path: versions/1.21.6/build/libs/anarchymod-mc-1.21.6-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.7
path: versions/1.21.7/build/libs/anarchymod-mc-1.21.7-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.8
path: versions/1.21.8/build/libs/anarchymod-mc-1.21.8-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.9
path: versions/1.21.9/build/libs/anarchymod-mc-1.21.9-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.10
path: versions/1.21.10/build/libs/anarchymod-mc-1.21.10-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-1.21.11
path: versions/1.21.11/build/libs/anarchymod-mc-1.21.11-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-26.1
path: versions/26.1/build/libs/anarchymod-mc-26.1-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-26.1.1
path: versions/26.1.1/build/libs/anarchymod-mc-26.1.1-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-26.1.2
path: versions/26.1.2/build/libs/anarchymod-mc-26.1.2-*.jar
if-no-files-found: error

- uses: actions/upload-artifact@v7
with:
name: anarchymod-mc-26.2
path: versions/26.2/build/libs/anarchymod-mc-26.2-*.jar
name: anarchymod-builds
path: |
versions/*/build/libs/anarchymod-mc-*.jar
!versions/*/build/libs/anarchymod-mc-*-sources.jar
if-no-files-found: error
163 changes: 109 additions & 54 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
description: "Version to release"
required: true
after-version:
description: 'Snapshot version after release'
description: "Snapshot version after release"
required: true

jobs:
Expand All @@ -33,8 +33,8 @@ jobs:
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
java-version: "25"
distribution: "temurin"

- name: Build with Gradle
run: ./gradlew chiseledBuild
Expand Down Expand Up @@ -84,72 +84,127 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
VERSION: ${{ inputs.version }}
REPO: ${{ github.repository }}
run: |
VERSION="${{ inputs.version }}"
REPO="${{ github.repository }}"
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}"

link() { echo "[${1}](${DOWNLOAD_URL}/anarchymod-mc-${1}-${VERSION}.jar)"; }
join() { local IFS=","; local out="$*"; echo "${out//,/, }"; }

mapfile -t MC_VERSIONS < <(for f in versions/*/gradle.properties; do
grep "^minecraft_version=" "$f" | cut -d= -f2
done | sort -V)

rows=()
group_key=""
group_links=()

flush_group() {
[ ${#group_links[@]} -eq 0 ] && return
rows+=("| ${group_key} | $(join "${group_links[@]}") |")
}

for v in "${MC_VERSIONS[@]}"; do
key=$(echo "$v" | cut -d. -f1,2)
if [ "$key" != "$group_key" ]; then
flush_group
group_key="$key"
group_links=()
fi
group_links+=("$(link "$v")")
done
flush_group

TABLE_ROWS=$(printf "%s\n" "${rows[@]}")

NOTES=$(cat <<EOF
## Downloads

| Minecraft Version | Download |
Grab the jar matching your Minecraft version. All builds are also attached below under Assets.

| Minecraft versions | Downloads |
|---|---|
| 1.19.4 | [\`anarchymod-mc-1.19.4-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.19.4-${VERSION}.jar) |
| 1.20 | [\`anarchymod-mc-1.20-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.20-${VERSION}.jar) |
| 1.20.1 | [\`anarchymod-mc-1.20.1-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.20.1-${VERSION}.jar) |
| 1.20.2 | [\`anarchymod-mc-1.20.2-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.20.2-${VERSION}.jar) |
| 1.20.3 | [\`anarchymod-mc-1.20.3-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.20.3-${VERSION}.jar) |
| 1.20.4 | [\`anarchymod-mc-1.20.4-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.20.4-${VERSION}.jar) |
| 1.20.5 | [\`anarchymod-mc-1.20.5-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.20.5-${VERSION}.jar) |
| 1.20.6 | [\`anarchymod-mc-1.20.6-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.20.6-${VERSION}.jar) |
| 1.21 | [\`anarchymod-mc-1.21-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21-${VERSION}.jar) |
| 1.21.1 | [\`anarchymod-mc-1.21.1-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.1-${VERSION}.jar) |
| 1.21.2 | [\`anarchymod-mc-1.21.2-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.2-${VERSION}.jar) |
| 1.21.3 | [\`anarchymod-mc-1.21.3-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.3-${VERSION}.jar) |
| 1.21.4 | [\`anarchymod-mc-1.21.4-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.4-${VERSION}.jar) |
| 1.21.5 | [\`anarchymod-mc-1.21.5-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.5-${VERSION}.jar) |
| 1.21.6 | [\`anarchymod-mc-1.21.6-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.6-${VERSION}.jar) |
| 1.21.7 | [\`anarchymod-mc-1.21.7-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.7-${VERSION}.jar) |
| 1.21.8 | [\`anarchymod-mc-1.21.8-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.8-${VERSION}.jar) |
| 1.21.9 | [\`anarchymod-mc-1.21.9-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.9-${VERSION}.jar) |
| 1.21.10 | [\`anarchymod-mc-1.21.10-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.10-${VERSION}.jar) |
| 1.21.11 | [\`anarchymod-mc-1.21.11-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-1.21.11-${VERSION}.jar) |
| 26.1 | [\`anarchymod-mc-26.1-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-26.1-${VERSION}.jar) |
| 26.1.1 | [\`anarchymod-mc-26.1.1-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-26.1.1-${VERSION}.jar) |
| 26.1.2 | [\`anarchymod-mc-26.1.2-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-26.1.2-${VERSION}.jar) |
| 26.2 | [\`anarchymod-mc-26.2-${VERSION}.jar\`](${DOWNLOAD_URL}/anarchymod-mc-26.2-${VERSION}.jar) |
${TABLE_ROWS}

${CHANGELOG}
EOF
)

shopt -s nullglob
ASSETS=(versions/*/build/libs/anarchymod-mc-*-"${VERSION}".jar)
shopt -u nullglob

if [ ${#ASSETS[@]} -eq 0 ]; then
echo "::error::No built jars matched versions/*/build/libs/anarchymod-mc-*-${VERSION}.jar - refusing to create an empty release." >&2
exit 1
fi

gh release create "${VERSION}" \
--title "AnarchyMod ${VERSION}" \
--notes "${NOTES}" \
versions/1.19.4/build/libs/anarchymod-mc-1.19.4-${VERSION}.jar \
versions/1.20/build/libs/anarchymod-mc-1.20-${VERSION}.jar \
versions/1.20.1/build/libs/anarchymod-mc-1.20.1-${VERSION}.jar \
versions/1.20.2/build/libs/anarchymod-mc-1.20.2-${VERSION}.jar \
versions/1.20.3/build/libs/anarchymod-mc-1.20.3-${VERSION}.jar \
versions/1.20.4/build/libs/anarchymod-mc-1.20.4-${VERSION}.jar \
versions/1.20.5/build/libs/anarchymod-mc-1.20.5-${VERSION}.jar \
versions/1.20.6/build/libs/anarchymod-mc-1.20.6-${VERSION}.jar \
versions/1.21/build/libs/anarchymod-mc-1.21-${VERSION}.jar \
versions/1.21.1/build/libs/anarchymod-mc-1.21.1-${VERSION}.jar \
versions/1.21.2/build/libs/anarchymod-mc-1.21.2-${VERSION}.jar \
versions/1.21.3/build/libs/anarchymod-mc-1.21.3-${VERSION}.jar \
versions/1.21.4/build/libs/anarchymod-mc-1.21.4-${VERSION}.jar \
versions/1.21.5/build/libs/anarchymod-mc-1.21.5-${VERSION}.jar \
versions/1.21.6/build/libs/anarchymod-mc-1.21.6-${VERSION}.jar \
versions/1.21.7/build/libs/anarchymod-mc-1.21.7-${VERSION}.jar \
versions/1.21.8/build/libs/anarchymod-mc-1.21.8-${VERSION}.jar \
versions/1.21.9/build/libs/anarchymod-mc-1.21.9-${VERSION}.jar \
versions/1.21.10/build/libs/anarchymod-mc-1.21.10-${VERSION}.jar \
versions/1.21.11/build/libs/anarchymod-mc-1.21.11-${VERSION}.jar \
versions/26.1/build/libs/anarchymod-mc-26.1-${VERSION}.jar \
versions/26.1.1/build/libs/anarchymod-mc-26.1.1-${VERSION}.jar \
versions/26.1.2/build/libs/anarchymod-mc-26.1.2-${VERSION}.jar \
versions/26.2/build/libs/anarchymod-mc-26.2-${VERSION}.jar
"${ASSETS[@]}"

- name: Update README download links
env:
VERSION: ${{ inputs.version }}
REPO: ${{ github.repository }}
run: |
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}"

link() { echo "[${1}](${DOWNLOAD_URL}/anarchymod-mc-${1}-${VERSION}.jar)"; }
join() { local IFS=","; local out="$*"; echo "${out//,/, }"; }

mapfile -t MC_VERSIONS < <(for f in versions/*/gradle.properties; do
grep "^minecraft_version=" "$f" | cut -d= -f2
done | sort -V)

rows=()
group_key=""
group_links=()
group_javas=()

flush_group() {
[ ${#group_links[@]} -eq 0 ] && return
mapfile -t uniq_java < <(printf "%s\n" "${group_javas[@]}" | sort -un)
java_label=$(IFS="/"; echo "${uniq_java[*]}")
rows+=("| $(join "${group_links[@]}") | ${java_label} |")
}

for v in "${MC_VERSIONS[@]}"; do
key=$(echo "$v" | cut -d. -f1,2)
jv=$(grep "^java_version=" "versions/$v/gradle.properties" | cut -d= -f2)
if [ "$key" != "$group_key" ]; then
flush_group
group_key="$key"
group_links=()
group_javas=()
fi
group_links+=("$(link "$v")")
group_javas+=("$jv")
done
flush_group

{
echo "| Minecraft versions | Required Java |"
echo "| :--- | :--- |"
printf "%s\n" "${rows[@]}"
} > /tmp/versions-table.md

awk -v tablefile=/tmp/versions-table.md '
BEGIN { while ((getline line < tablefile) > 0) table = table line "\n" }
/<!-- versions-table:start -->/ { print; printf "%s", table; skip=1; next }
/<!-- versions-table:end -->/ { skip=0 }
!skip { print }
' README.md > README.md.new
mv README.md.new README.md

- name: Commit README
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "chore(release): update README download links for ${{ inputs.version }}"
file_pattern: README.md

set-after-version:
needs: build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/set-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version to set'
description: "Version to set"
required: true
workflow_call:
inputs:
Expand Down Expand Up @@ -32,4 +32,4 @@ jobs:
- name: Commit Version
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: 'chore(release): bump version to ${{ inputs.version }}'
commit_message: "chore(release): bump version to ${{ inputs.version }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ gradle-app.setting
*.ipr

**/run/
/versions/*/logs
Loading