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 9583ec0 commit 9a11c75
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/Build and Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,29 +143,35 @@ jobs:
# 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
ORIONVERSION=$(awk 'BEGIN { RS = ""; FS = "\n"; highest_version = "" } $1 ~ /^Package: dev.theos.orion14$/ && $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 "Orion Version Extracted: $ORIONVERSION"
FILENAME=$(awk 'BEGIN{RS="";FS="\n";highest_version=""} $1~/^Package: dev.theos.orion14$/ && $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 "Orion FileName Extracted: $FILENAME"
SHA256=$(awk 'BEGIN{RS="";FS="\n";highest_version="";sha256="noSHA"} $1~/^Package: dev.theos.orion14$/ && $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 "Orion SHA256 Hash Extracted: $SHA256"
MD5=$(awk 'BEGIN{RS="";FS="\n";highest_version="";md5sum="noMD5"} $1~/^Package: dev.theos.orion14$/ && $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 "Orion MD5 Hash Extracted: $MD5"

#Download the .deb file
echo "Download URL: https://repo.chariz.com/$FILENAME"
echo "Downloading From: https://repo.chariz.com/$FILENAME"
curl -o "Build Components/orion" "https://repo.chariz.com/$FILENAME"
echo "orion=Build Components/orion" >> $GITHUB_ENV


#Check Hash
if [[ "${{ SHA256 }}" != "noSHA" ]]; then
echo "SHA256 Hash: ${{ SHA256 }}"
echo "Expected SHA256 Hash: ${{ SHA256 }}"
calculated_sha256=$(sha256sum "$orion" | 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 "MD5 Hash: ${{ MD5 }}"
echo "Expected MD5 Hash: ${{ MD5 }}"
calculated_md5=$(md5sum "$orion" | awk '{print $1}')
echo "Calculated MD5 Hash: $calculated_md5"
if [[ "${calculated_md5}" == "${MD5}" ]]; then
echo "MD5 matches. Continuing..."
else
Expand All @@ -177,6 +183,9 @@ jobs:
exit 1
fi

#CleanUp
rm -f Packages

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

0 comments on commit 9a11c75

Please sign in to comment.