-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to check versions in the modpack index
See #5.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 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,19 @@ | ||
# SPDX-License-Identifier: MIT | ||
# SPDX-FileCopyrightText: Louis Moureaux <[email protected]> | ||
|
||
name: Check versions | ||
on: | ||
push: {} | ||
pull_request: {} | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: sudo apt-get install curl jq | ||
- run: sh check-versions.sh | ||
|
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,21 @@ | ||
#!/bin/sh | ||
|
||
# SPDX-License-Identifier: MIT | ||
# SPDX-FileCopyrightText: Tobias Rehbein <[email protected]> | ||
|
||
# Checks that the version numbers in the index file match those in the | ||
# modpacks. | ||
|
||
IFS='|' | ||
jq -r '.modpacks[] | "\(.name)|\(.version)|\(.url)"' index.json \ | ||
| while read NAME VERSION URL; do | ||
RVERSION=$({ if $(echo "$URL" | grep -q '^http'); then | ||
curl -s "$URL" | ||
else | ||
cat "$URL" | ||
fi } | jq -r '.info.version') | ||
|
||
[ "$VERSION" != "$RVERSION" ] \ | ||
&& echo "Version mismatch for \"$NAME\": index $VERSION; remote $RVERSION" | ||
done | ||
|