-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.21.3' into 1.21.3-neoforge
- Loading branch information
Showing
22 changed files
with
1,270 additions
and
109 deletions.
There are no files selected for viewing
This file contains 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,17 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "github-actions" | ||
# Directory should be `/` instead of `/.github/workflows` according to the docs. | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains 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,32 @@ | ||
name: Check Translations | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "dependabot/**" | ||
tags-ignore: | ||
- "**" | ||
paths: | ||
- "src/main/resources/assets/wi_zoom/lang/**.json" | ||
- "src/main/resources/intentionally_untranslated.json" | ||
pull_request: | ||
paths: | ||
- "src/main/resources/assets/wi_zoom/lang/**.json" | ||
- "src/main/resources/intentionally_untranslated.json" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check_translations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Run check_translations.py | ||
run: python scripts/check_translations.py |
This file contains 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 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 |
---|---|---|
|
@@ -2,8 +2,8 @@ name: Java CI with Gradle | |
|
||
on: | ||
push: | ||
branches: | ||
- "**" | ||
branches-ignore: | ||
- "dependabot/**" | ||
tags-ignore: | ||
- "**" | ||
paths: | ||
|
@@ -20,6 +20,10 @@ on: | |
- "gradle**" | ||
- "*.gradle" | ||
workflow_dispatch: | ||
inputs: | ||
distinct_id: | ||
description: "Automatically set by the return-dispatch action (leave blank if running manually)" | ||
required: false | ||
|
||
jobs: | ||
build: | ||
|
@@ -29,6 +33,9 @@ jobs: | |
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }} | ||
steps: | ||
|
||
- name: Echo distinct ID ${{ github.event.inputs.distinct_id }} | ||
run: echo ${{ github.event.inputs.distinct_id }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
|
@@ -57,7 +64,10 @@ jobs: | |
run: ./gradlew spotlessJsonCheck || (echo "::error::JSON validation failed! Run './gradlew spotlessApply' to fix style issues, or check the full error message for syntax errors." && exit 1) | ||
|
||
- name: Validate Java code style | ||
run: ./gradlew spotlessCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1) | ||
run: ./gradlew spotlessJavaCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1) | ||
|
||
- name: Validate license headers | ||
run: ./gradlew spotlessLicenseHeaderCheck || (echo "::error::License headers are missing or malformed in some files! Run './gradlew spotlessApply' to fix this, or check the full error message for details." && exit 1) | ||
|
||
- name: Run unit tests | ||
run: ./gradlew test --stacktrace --warning-mode=fail | ||
|
@@ -79,7 +89,6 @@ jobs: | |
|
||
- name: Add VirusTotal links to build summary | ||
if: ${{ env.VIRUSTOTAL_API_KEY && steps.virustotal.outputs.analysis }} | ||
shell: bash | ||
run: | | ||
echo "<details open>" >> $GITHUB_STEP_SUMMARY | ||
echo "<summary>🛡️ VirusTotal Scans</summary>" >> $GITHUB_STEP_SUMMARY | ||
|
@@ -92,3 +101,51 @@ jobs: | |
echo "- [$filename]($url)" >> $GITHUB_STEP_SUMMARY | ||
done | ||
echo "</details>" >> $GITHUB_STEP_SUMMARY | ||
- name: Run the mod and take screenshots | ||
uses: GabrielBB/[email protected] | ||
with: | ||
run: ./gradlew runEndToEndTest --stacktrace --warning-mode=fail | ||
|
||
# Needed because the screenshot gallery won't be created on pull requests. | ||
# Also useful if Imgur uploads fail. | ||
- name: Upload Test Screenshots.zip artifact | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: Test Screenshots | ||
path: runs/client/screenshots | ||
|
||
- name: Create test screenshot gallery | ||
if: ${{ env.IMGUR_CLIENT_ID && (success() || failure()) }} | ||
# Imgur uploads randomly fail sometimes, probably because of the low rate limit. | ||
# TODO: Find a better place to upload the screenshots. | ||
continue-on-error: true | ||
run: | | ||
echo "<details open>" >> $GITHUB_STEP_SUMMARY | ||
echo "<summary>📸 Test Screenshots</summary>" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
for img in runs/client/screenshots/*.png; do | ||
if [ -f "$img" ]; then | ||
filename=$(basename "$img") | ||
name_without_ext="${filename%.*}" | ||
# Upload to Imgur | ||
response=$(curl -s -X POST \ | ||
-H "Authorization: Client-ID $IMGUR_CLIENT_ID" \ | ||
-F "image=@$img" \ | ||
https://api.imgur.com/3/image) | ||
# Extract the URL from the response | ||
url=$(echo $response | grep -o '"link":"[^"]*"' | cut -d'"' -f4) | ||
if [ ! -z "$url" ]; then | ||
# Convert underscores to spaces and capitalize first letter of each word | ||
title=$(echo "$name_without_ext" | tr '_' ' ' | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1') | ||
echo "### $title" >> $GITHUB_STEP_SUMMARY | ||
echo "![${name_without_ext}]($url)" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "Failed to upload $filename" >> $GITHUB_STEP_SUMMARY | ||
echo "Imgur upload response for $filename: $response" | ||
fi | ||
fi | ||
done | ||
echo "</details>" >> $GITHUB_STEP_SUMMARY |
This file contains 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 |
---|---|---|
@@ -1,4 +1,11 @@ | ||
name: Publish Release | ||
run-name: "Publish release from ${{ github.ref_name }} branch" | ||
|
||
permissions: | ||
# Needed to push the tag. | ||
contents: write | ||
# Needed to close the milestone. | ||
issues: write | ||
|
||
on: | ||
workflow_dispatch: | ||
|
@@ -28,6 +35,14 @@ on: | |
required: true | ||
type: boolean | ||
default: true | ||
update_website: | ||
description: "Update wimods.net post (only works if there already is one and publish_curseforge is true)" | ||
required: false | ||
type: boolean | ||
default: false | ||
distinct_id: | ||
description: "Automatically set by the return-dispatch action (leave blank if running manually)" | ||
required: false | ||
|
||
jobs: | ||
publish: | ||
|
@@ -37,51 +52,107 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} | ||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Java 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "microsoft" | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Build | ||
run: ./gradlew build --stacktrace --warning-mode=fail | ||
|
||
- name: Create and push tag | ||
run: | | ||
MOD_VERSION=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | tr -d ' ') | ||
git config --global user.name "Wurst-Bot" | ||
git config --global user.email "[email protected]" | ||
git tag v$MOD_VERSION | ||
git push origin v$MOD_VERSION | ||
- name: Close milestone | ||
if: ${{ inputs.close_milestone }} | ||
run: ./gradlew closeMilestone --stacktrace | ||
|
||
- name: Upload backups | ||
if: ${{ inputs.upload_backups }} | ||
run: ./gradlew uploadBackups --stacktrace | ||
|
||
- name: Publish to GitHub | ||
if: ${{ inputs.publish_github }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.MCX_PUBLISH_TOKEN }} | ||
run: ./gradlew github --stacktrace | ||
|
||
- name: Publish to CurseForge | ||
if: ${{ inputs.publish_curseforge }} | ||
run: ./gradlew publishCurseforge --stacktrace | ||
|
||
- name: Publish to Modrinth | ||
if: ${{ inputs.publish_modrinth }} | ||
run: ./gradlew publishModrinth --stacktrace | ||
|
||
- name: Echo distinct ID ${{ github.event.inputs.distinct_id }} | ||
run: echo ${{ github.event.inputs.distinct_id }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
# Include all tags in case the new tag already exists. | ||
fetch-tags: true | ||
|
||
- name: Set up Java 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "microsoft" | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Build | ||
run: ./gradlew build --stacktrace --warning-mode=fail | ||
|
||
- name: Create and push tag | ||
run: | | ||
MOD_VERSION=$(grep "^mod_version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r') | ||
git config --global user.name "Wurst-Bot" | ||
git config --global user.email "[email protected]" | ||
git tag "v$MOD_VERSION" | ||
git push origin "v$MOD_VERSION" | ||
- name: Close milestone | ||
if: ${{ inputs.close_milestone }} | ||
run: ./gradlew closeMilestone --stacktrace | ||
|
||
- name: Upload backups | ||
if: ${{ inputs.upload_backups }} | ||
run: ./gradlew uploadBackups --stacktrace | ||
|
||
- name: Publish to GitHub | ||
if: ${{ inputs.publish_github }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.MCX_PUBLISH_TOKEN }} | ||
run: ./gradlew github --stacktrace | ||
|
||
- name: Publish to CurseForge | ||
if: ${{ inputs.publish_curseforge }} | ||
run: ./gradlew publishCurseforge --stacktrace | ||
|
||
- name: Get CurseForge file ID | ||
id: cf_file_id | ||
if: ${{ inputs.publish_curseforge }} | ||
run: | | ||
file_id=$(./gradlew getCurseforgeId -x publishCurseforge | grep -o 'CURSEFORGE_FILE_ID=[0-9]*' | grep -o '[0-9]*') | ||
echo "file_id=$file_id" >> "$GITHUB_OUTPUT" | ||
echo "CurseForge file ID: \`$file_id\`" >> $GITHUB_STEP_SUMMARY | ||
- name: Publish to Modrinth | ||
if: ${{ inputs.publish_modrinth }} | ||
run: ./gradlew publishModrinth --stacktrace | ||
|
||
- name: Build website update inputs | ||
id: website_inputs | ||
if: ${{ inputs.update_website && inputs.publish_curseforge }} | ||
run: | | ||
MOD_VERSION=$(grep "^mod_version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r' | sed 's/-MC.*$//') | ||
MC_VERSION=$(grep "^minecraft_version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r') | ||
JSON_STRING=$(cat << EOF | ||
{ | ||
"mod": "wi-zoom", | ||
"modloader": "neoforge", | ||
"mod_version": "$MOD_VERSION", | ||
"mc_version": "$MC_VERSION", | ||
"file_id": "${{ steps.cf_file_id.outputs.file_id }}" | ||
} | ||
EOF | ||
) | ||
# Convert to single line and escape quotes | ||
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT" | ||
- name: Trigger website update | ||
id: website_dispatch | ||
if: ${{ inputs.update_website && inputs.publish_curseforge }} | ||
uses: codex-/return-dispatch@v2 | ||
with: | ||
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }} | ||
owner: Wurst-Imperium | ||
repo: wimods.net | ||
ref: master | ||
workflow: add_mod_port.yml | ||
workflow_inputs: ${{ steps.website_inputs.outputs.json }} | ||
|
||
- name: Wait for website update to finish (run ${{ steps.website_dispatch.outputs.run_id }}) | ||
if: ${{ inputs.update_website && inputs.publish_curseforge }} | ||
uses: codex-/await-remote-run@v1 | ||
with: | ||
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }} | ||
owner: Wurst-Imperium | ||
repo: wimods.net | ||
run_id: ${{ steps.website_dispatch.outputs.run_id }} | ||
run_timeout_seconds: 600 # 10 minutes |
Oops, something went wrong.