Move the updating payload process to its own script and fix the action
Also, Atmosphere was updated in the processpull/77/head
parent
e08d745149
commit
5976e478ab
|
@ -13,70 +13,21 @@ jobs:
|
|||
- name: Install jq
|
||||
run: sudo apt install -y jq
|
||||
|
||||
- name: Determine actual and latest versions of all payloads
|
||||
run: |
|
||||
# To-do: Maybe improve this process?
|
||||
|
||||
# Actual versions
|
||||
echo "AMS_VERSION=$(sed -n 5p payloads/payloads.json | cut -d '"' -f4)" >> $GITHUB_ENV
|
||||
echo "HKT_VERSION=$(sed -n 10p payloads/payloads.json | cut -d '"' -f4)" >> $GITHUB_ENV
|
||||
echo "TEX_VERSION=$(sed -n 15p payloads/payloads.json | cut -d '"' -f4)" >> $GITHUB_ENV
|
||||
|
||||
# Latest versions
|
||||
echo "AMS_LATEST=$(curl -s https://api.github.com/repos/Atmosphere-NX/Atmosphere/releases/latest | grep tag_name | cut -d '"' -f4)" >> $GITHUB_ENV
|
||||
echo "HKT_LATEST=$(curl -s https://api.github.com/repos/CTCaer/hekate/releases/latest | grep tag_name | cut -d '"' -f4)" >> $GITHUB_ENV
|
||||
echo "TEX_LATEST=$(curl -s https://api.github.com/repos/suchmememanyskill/TegraExplorer/releases/latest | grep tag_name | cut -d '"' -f4)" >> $GITHUB_ENV
|
||||
- name: Update required payloads
|
||||
run: |
|
||||
mkdir payloads/temp && cd payloads/temp
|
||||
UPDATE=false
|
||||
|
||||
if [[ "$AMS_VERSION" -ne "AMS_LATEST" ]]
|
||||
then
|
||||
UPDATE=true
|
||||
rm ../ams-*.bin
|
||||
wget $(curl -s https://api.github.com/repos/Atmosphere-NX/Atmosphere/releases/latest | grep browser_download_url | grep fusee.bin | cut -d '"' -f4)
|
||||
mv fusee.bin ../ams-$AMS_LATEST.bin
|
||||
|
||||
jq --arg version "$AMS_LATEST" '.payloads[0].version |= $version' ../payloads.json | jq --arg path "payloads/ams-$AMS_LATEST.bin" '.payloads[0].path |= $path' > ../payloads_temp.json
|
||||
mv ../payloads_temp.json ../payloads.json
|
||||
fi
|
||||
|
||||
if [[ "$HKT_VERSION" -ne "HKT_LATEST" ]]
|
||||
then
|
||||
UPDATE=true
|
||||
rm ../hekate-*.bin
|
||||
wget $(curl -s https://api.github.com/repos/CTCaer/hekate/releases/latest | grep browser_download_url | grep "hekate_ctcaer_.*\.zip" | cut -d '"' -f4)
|
||||
unzip hekate_ctcaer_*.zip
|
||||
mv hekate_ctcaer_*.bin ../hekate-$HKT_LATEST.bin
|
||||
|
||||
jq --arg version "$HKT_LATEST" '.payloads[1].version |= $version' ../payloads.json | jq --arg path "payloads/hekate-$HKT_LATEST.bin" '.payloads[1].path |= $path' > ../payloads_temp.json
|
||||
mv ../payloads_temp.json ../payloads.json
|
||||
fi
|
||||
|
||||
if [[ "$TEX_VERSION" -ne "$TEX_LATEST" ]]
|
||||
then
|
||||
UPDATE=true
|
||||
rm ../tegraexplorer-*.bin
|
||||
wget $(curl -s https://api.github.com/repos/suchmememanyskill/TegraExplorer/releases/latest | grep browser_download_url | grep TegraExplorer.bin | cut -d '"' -f4)
|
||||
mv TegraExplorer.bin ../tegraexplorer-$TEX_LATEST.bin
|
||||
|
||||
jq --arg version "$TEX_LATEST" '.payloads[2].version |= $version' ../payloads.json | jq --arg path "payloads/hekate-$TEX_LATEST.bin" '.payloads[2].path |= $path' > ../payloads_temp.json
|
||||
mv ../payloads_temp.json ../payloads.json
|
||||
fi
|
||||
|
||||
echo "UPDATE=$UPDATE" >> $GITHUB_ENV
|
||||
cd ../.. && rm -r payloads/temp
|
||||
- name: Update payloads
|
||||
run: sh extras/update-payloads.sh
|
||||
|
||||
- name: Commit changes if necessary
|
||||
run: |
|
||||
if [[ "$UPDATE" -eq true ]]
|
||||
if [ "$UPDATE" == true ];
|
||||
then
|
||||
echo 'Commiting changes!'
|
||||
git config --global user.name 'GitHub Actions'
|
||||
git config --global user.email 'github-actions@users.noreply.github.com'
|
||||
git add --all
|
||||
git commit -am ":robot: Payloads updated automatically"
|
||||
git push
|
||||
else
|
||||
echo "Commit not needed."
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash
|
||||
|
||||
# To-do: Use jq for everything instead of sed, grep and cut
|
||||
|
||||
# Actual versions
|
||||
AMS_VERSION=$(sed -n 5p payloads/payloads.json | cut -d '"' -f4)
|
||||
HKT_VERSION=$(sed -n 10p payloads/payloads.json | cut -d '"' -f4)
|
||||
TEX_VERSION=$(sed -n 15p payloads/payloads.json | cut -d '"' -f4)
|
||||
|
||||
# Latest versions
|
||||
AMS_LATEST=$(curl -s https://api.github.com/repos/Atmosphere-NX/Atmosphere/releases | jq '.[0]' | grep tag_name | cut -d '"' -f4)
|
||||
HKT_LATEST=$(curl -s https://api.github.com/repos/CTCaer/hekate/releases | jq '.[0]' | grep tag_name | cut -d '"' -f4)
|
||||
TEX_LATEST=$(curl -s https://api.github.com/repos/suchmememanyskill/TegraExplorer/releases | jq '.[0]' | grep tag_name | cut -d '"' -f4)
|
||||
|
||||
if [ -d payloads/temp ];
|
||||
then
|
||||
echo "Leftover temp directory detected. Deleting it..."
|
||||
rm -r payloads/temp
|
||||
fi
|
||||
|
||||
mkdir payloads/temp && cd payloads/temp
|
||||
UPDATE=false
|
||||
|
||||
if [[ "$AMS_VERSION" != "$AMS_LATEST" ]];
|
||||
then
|
||||
echo "Newest Atmosphere version detected ($AMS_LATEST). Updating..."
|
||||
UPDATE=true
|
||||
rm ../ams-*.bin
|
||||
wget $(curl -s https://api.github.com/repos/Atmosphere-NX/Atmosphere/releases | jq '.[0]' | grep browser_download_url | grep fusee.bin | cut -d '"' -f4)
|
||||
mv fusee.bin ../ams-$AMS_LATEST.bin
|
||||
|
||||
jq --arg version "$AMS_LATEST" '.payloads[0].version |= $version' ../payloads.json | jq --arg path "payloads/ams-$AMS_LATEST.bin" '.payloads[0].path |= $path' > ../payloads_temp.json
|
||||
mv ../payloads_temp.json ../payloads.json
|
||||
echo "Atmosphere successfully updated! "
|
||||
fi
|
||||
|
||||
if [[ "$HKT_VERSION" != "$HKT_LATEST" ]];
|
||||
then
|
||||
echo "Newest Hekate version detected ($HKT_LATEST). Updating..."
|
||||
UPDATE=true
|
||||
rm ../hekate-*.bin
|
||||
wget $(curl -s https://api.github.com/repos/CTCaer/hekate/releases | jq '.[0]' | grep browser_download_url | grep "hekate_ctcaer_.*\.zip" | cut -d '"' -f4)
|
||||
unzip hekate_ctcaer_*.zip
|
||||
mv hekate_ctcaer_*.bin ../hekate-$HKT_LATEST.bin
|
||||
|
||||
jq --arg version "$HKT_LATEST" '.payloads[1].version |= $version' ../payloads.json | jq --arg path "payloads/hekate-$HKT_LATEST.bin" '.payloads[1].path |= $path' > ../payloads_temp.json
|
||||
mv ../payloads_temp.json ../payloads.json
|
||||
echo "Hekate successfully updated!"
|
||||
fi
|
||||
|
||||
if [[ "$TEX_VERSION" != "$TEX_LATEST" ]];
|
||||
then
|
||||
echo "Newset TegraExplorer version detected ($TEX_LATEST). Updating..."
|
||||
UPDATE=true
|
||||
rm ../tegraexplorer-*.bin
|
||||
wget $(curl -s https://api.github.com/repos/suchmememanyskill/TegraExplorer/releases | jq '.[0]' | grep browser_download_url | grep TegraExplorer.bin | cut -d '"' -f4)
|
||||
mv TegraExplorer.bin ../tegraexplorer-$TEX_LATEST.bin
|
||||
|
||||
jq --arg version "$TEX_LATEST" '.payloads[2].version |= $version' ../payloads.json | jq --arg path "payloads/hekate-$TEX_LATEST.bin" '.payloads[2].path |= $path' > ../payloads_temp.json
|
||||
mv ../payloads_temp.json ../payloads.json
|
||||
echo 'TegraExplorer successfully updated!'
|
||||
fi
|
||||
|
||||
cd ../.. && rm -r payloads/temp
|
||||
|
||||
if [[ -n "$GITHUB_ACTIONS" ]];
|
||||
then
|
||||
echo "UPDATE=$UPDATE" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
echo "Update complete."
|
|
@ -2,8 +2,8 @@
|
|||
"payloads": [
|
||||
{
|
||||
"name": "Atmosphère",
|
||||
"version": "1.5.3",
|
||||
"path": "payloads/ams-1.5.3.bin"
|
||||
"version": "1.5.4",
|
||||
"path": "payloads/ams-1.5.4.bin"
|
||||
},
|
||||
{
|
||||
"name": "Hekate",
|
||||
|
|
Loading…
Reference in New Issue