Skip to content

Commit

Permalink
feat*: ci improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Feb 4, 2025
1 parent 52050a4 commit 9a1fe71
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- "[0-9]+\.[0-9]+/main"
- "[0-9]+.[0-9]+/main"

jobs:
build:
Expand All @@ -30,10 +30,20 @@ jobs:
echo "Could not find minecraft_version in gradle.properties"
exit 1
fi
echo "$MC_VERSION" >> GITHUB_ENV
echo "Minecraft version is $MC_VERSION"
- name: Pull meta data
env:
MC_VERSION: ${{ env.MC_VERSION }}
# Get the latest hash from the API for this mc version or default to the first commit on this branch
run: |
export LAST_HASH=$((curl https://api.feed-the-beast.com/versions/mods/ftb-promoter/${MC_VERSION} | jq -r -e .hash) || git rev-list HEAD | tail -n 1)
git log --pretty=full $LAST_HASH..HEAD >> COMMIT_HISTORY
export LAST_HASH=$(curl https://api.feed-the-beast.com/v1/meta/versions/mods/ftb-promoter/${MC_VERSION} | jq -r -e .hash)
if [ -z "$LAST_HASH" ] || [ "$LAST_HASH" == "null" ]; then
echo "No hash found for $MC_VERSION, defaulting to first commit on this branch"
export LAST_HASH=$(git rev-list --max-parents=0 HEAD)
fi
echo "Last hash is $LAST_HASH"
git log --format=full $LAST_HASH..HEAD > COMMIT_HISTORY
- name: Download FTB Worlds
run: |
mkdir -p libs
Expand All @@ -53,4 +63,4 @@ jobs:
# Get the current commit hash and push it against the minecraft version
run: |
export CURRENT_HASH=$(git rev-parse HEAD)
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${{ secrets.META_TOKEN }}" -d "{\"hash\":\"$CURRENT_HASH\"}" https://api.feed-the-beast.com/versions/mods/ftb-promoter/${MC_VERSION}
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${{ secrets.META_TOKEN }}" -d "{\"hash\":\"$CURRENT_HASH\"}" https://api.feed-the-beast.com/v1/meta/versions/mods/ftb-promoter/${MC_VERSION}

0 comments on commit 9a1fe71

Please sign in to comment.