Skip to content

Commit

Permalink
Update Build and Release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yodaluca23 authored Jun 22, 2024
1 parent c1fd55d commit da6eb35
Showing 1 changed file with 62 additions and 2 deletions.
64 changes: 62 additions & 2 deletions .github/workflows/Build and Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
if: ${{ env.VIRUSTOTALKEY }}
run: echo "VTSWIFTPROTOBUF=${{ steps.vt-swiftprotobuf.outputs.analysis }}" >> $GITHUB_ENV

- name: Download and process Orion Runtime
- name: Download and process Orion
run: |
# Download the Packages file from repo.chariz.com
curl -sSL https://repo.chariz.com/Packages -o Packages
Expand Down Expand Up @@ -199,8 +199,10 @@ jobs:
#CleanUp
rm -f Packages

#Set Env Varibles
echo "orion=Build Components/$downloaded_file" >> $GITHUB_ENV

echo "ORIONVERSION=$orion_version" >> $GITHUB_ENV

- name: Upload Orion to VirusTotal
if: ${{ env.VIRUSTOTALKEY }}
uses: crazy-max/ghaction-virustotal@v4
Expand All @@ -222,6 +224,64 @@ jobs:
echo "sposify=Build Components/sposify" >> $GITHUB_ENV
echo "SPOSIFYVERSION=$sposify_version" >> $GITHUB_ENV
- name: Download and process Sposify
run: |
# Download the Packages file
curl -sSL https://repo.dynastic.co/Packages -o Packages
# Use awk to find entries for dev.theos.orion14, Architecture: iphoneos-arm, find the highest version
# extract the version, filename, SHA256 Hash, and MD5 hash
SPOSIFYVERSION=$(awk 'BEGIN { RS = ""; FS = "\n"; highest_version = "" } $1 ~ /^Package: com.spos$/ && $0 ~ /Architecture: iphoneos-arm([^6]|$)/ { for (i = 1; i <= NF; i++) { if ($i ~ /^Version: /) { split($i, a, " "); version = a[2]; if (highest_version == "" || version > highest_version) { highest_version = version } } } } END { if (highest_version != "") print highest_version }' Packages)
echo "Sposify Version Extracted: $ORIONVERSION"
FILENAME=$(awk 'BEGIN{RS="";FS="\n";highest_version=""} $1~/^Package: com.spos$/ && $0~/Architecture: iphoneos-arm/{current_version="";current_filename="";for(i=1;i<=NF;i++){if($i~/^Version: /){split($i,a," ");version=a[2];if(current_version==""||version>current_version){current_version=version}}else if($i~/^Filename: /){split($i,a," ");current_filename=a[2]}}if(highest_version==""||current_version>highest_version){highest_version=current_version;highest_filename=current_filename}} END{if(highest_version!="")print highest_filename}' Packages)
echo "Sposify FileName Extracted: $FILENAME"
SHA256=$(awk 'BEGIN{RS="";FS="\n";highest_version="";sha256="noSHA"} $1~/^Package: com.spos$/ && $0~/Architecture: iphoneos-arm/{current_version="";sha256_found=0;for(i=1;i<=NF;i++){if($i~/^Version: /){split($i,a," ");version=a[2];if(current_version==""||version>current_version){current_version=version}}else if($i~/^SHA256: /){split($i,a," ");sha256=a[2];sha256_found=1}}if(highest_version==""||current_version>highest_version){highest_version=current_version;if(sha256_found==1){highest_sha256=sha256}else{highest_sha256="noSHA"}}}END{if(highest_version!="")print highest_sha256}' Packages)
echo "Sposify SHA256 Hash Extracted: $SHA256"
MD5=$(awk 'BEGIN{RS="";FS="\n";highest_version="";md5sum="noMD5"} $1~/^Package: com.spos$/ && $0~/Architecture: iphoneos-arm/{current_version="";for(i=1;i<=NF;i++){if($i~/^Version: /){split($i,a," ");version=a[2];if(current_version==""||version>current_version){current_version=version}}else if($i~/^MD5Sum: /){split($i,a," ");md5sum=a[2]}}if(highest_version==""||current_version>highest_version){highest_version=current_version;highest_md5sum=md5sum}} END{if(highest_version!="")print highest_md5sum}' Packages)
echo "Sposify MD5 Hash Extracted: $MD5"

echo "Downloading From: https://repo.dynastic.co/$FILENAME"
# Download the file using curl
curl -LJO "https://repo.dynastic.co/$FILENAME"
downloaded_file=$(ls -t | head -n1)
mv "$downloaded_file" "Build Components/"
sposify="Build Components/$downloaded_file"

#Check Hash
if [[ "${SHA256}" != "noSHA" ]]; then
echo "Expected SHA256 Hash: ${SHA256}"
echo "Sposify path: $sposify"
calculated_sha256=$(shasum -a 256 "$sposify" | awk '{print $1}')
echo "Calculated SHA256 Hash: $calculated_sha256"
if [[ "${calculated_sha256}" == "${SHA256}" ]]; then
echo "SHA256 matches. Continuing..."
else
echo "SHA256 does not match."
exit 1
fi
elif [[ "${MD5}" != "noMD5" ]]; then
echo "Expected MD5 Hash: ${MD5}"
calculated_md5=$(md5 -q "$sposify" | awk '{print $1}')
echo "Calculated MD5 Hash: $calculated_md5"
if [[ "${calculated_md5}" == "${MD5}" ]]; then
echo "MD5 matches. Continuing..."
else
echo "MD5 does not match."
exit 1
fi
else
echo "Neither SHA256 nor MD5 is valid"
exit 1
fi

#CleanUp
rm -f Packages

#Set Env Varibles
echo "sposify=Build Components/$downloaded_file" >> $GITHUB_ENV
echo "SPOSIFYVERSION=$sposify_version" >> $GITHUB_ENV


- name: Upload Sposify to VirusTotal
if: ${{ env.VIRUSTOTALKEY }}
uses: crazy-max/ghaction-virustotal@v4
Expand Down

0 comments on commit da6eb35

Please sign in to comment.