Skip to content

Commit

Permalink
Updated yml action file
Browse files Browse the repository at this point in the history
  • Loading branch information
crlngn committed Feb 12, 2025
1 parent 6eae37f commit a102381
Showing 1 changed file with 2 additions and 42 deletions.
44 changes: 2 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,51 +82,11 @@ jobs:
"release": {
"version": "'"$VERSION"'",
"manifest": "https://github.com/${{ github.repository }}/releases/latest/download/module.json",
"notes": "https://github.com/${{ github.repository }}/releases/tag/v$VERSION",
"notes": "https://github.com/${{ github.repository }}/releases/tag/v'"$VERSION"'",
"compatibility": {
"minimum": "12.328",
"verified": "12.331"
}
}
}')
echo "Latest Release API Response: $API_RESPONSE"
- name: Update Previous Release on FoundryVTT
env:
FOUNDRY_PACKAGE_API_KEY: ${{ secrets.FOUNDRY_PACKAGE_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Fetching second latest release from GitHub..."
RELEASES=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/releases" | jq -r 'map(.tag_name) | sort_by(.) | reverse')
# Extract the second latest release (previous release)
PREV_RELEASE=$(echo "$RELEASES" | jq -r '.[1]')
if [ -z "$PREV_RELEASE" ] || [ "$PREV_RELEASE" == "null" ]; then
echo "No previous release found. Skipping update."
exit 0
fi
CLEAN_VERSION="${PREV_RELEASE#v}"
echo "Previous release found: $CLEAN_VERSION"
echo "Updating FoundryVTT release for previous version $CLEAN_VERSION..."
API_RESPONSE=$(curl -s -X POST "https://api.foundryvtt.com/_api/packages/release_version/" \
-H "Content-Type: application/json" \
-H "Authorization: $FOUNDRY_PACKAGE_API_KEY" \
-d '{
"id": "'"$REPO_NAME"'",
"release": {
"version": "'"$CLEAN_VERSION"'",
"manifest": "https://github.com/${{ github.repository }}/releases/download/'"$PREV_RELEASE"'/module.json",
"notes": "https://github.com/${{ github.repository }}/releases/tag/'"$PREV_RELEASE"'",
"compatibility": {
"minimum": "12.328",
"verified": "12.331"
}
}
}')
echo "Updated previous release $CLEAN_VERSION - Response: $API_RESPONSE"
echo "Latest Release API Response: $API_RESPONSE"

0 comments on commit a102381

Please sign in to comment.