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 Jul 11, 2024
1 parent 88239ea commit 86e2dcb
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions .github/workflows/Build and Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: 'Direct URL to Spotify .ipa'
required: true
CHANGEVERSION:
description: 'SpotveeC Version Number'
description: 'SpotVeeC Version Number'
required: false
USEACTIONSEEVEE:
description: 'Get EeveeSpotify from latest EeveeSpotfiy build action'
Expand All @@ -18,7 +18,7 @@ on:
description: 'EeveeSpotify Version'
required: false
EEVEEREPO:
description: 'Override the repo for EeveeSpotify'
description: 'Override repo for EeveeSpotify'
required: false

jobs:
Expand Down Expand Up @@ -50,7 +50,6 @@ jobs:
- name: Set EeveeSpotify Repo if not given
if: ${{ github.event.inputs.EEVEEREPO == '' }}
run: |
EEVEEREPO=$(echo "whoeevee/EeveeSpotify")
echo "EEVEEREPO=$EEVEEREPO" >> $GITHUB_ENV
Expand Down Expand Up @@ -85,7 +84,7 @@ jobs:
echo "No matching tag found for EEVEEVERSION=$EEVEEVERSION"
exit 1
echo "Using Release Tag: $EEVEETAG"
- name: Create Build Components folder
run: mkdir -p "Build Components"

Expand Down Expand Up @@ -117,15 +116,15 @@ jobs:
# Download the Packages file from repo.chariz.com
curl -sSL https://repo.chariz.com/Packages -o Packages
# Use awk to find entries for dev.theos.orion14, Architecture: iphoneos-arm64, find the highest version
# 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-arm64([^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)
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-arm64/{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)
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-arm64/{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)
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-arm64/{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)
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"

echo "Downloading From: https://repo.chariz.com/$FILENAME"
Expand Down Expand Up @@ -181,17 +180,17 @@ jobs:
- name: Set VirusTotal Analysis URL for Orion
if: ${{ env.VIRUSTOTALKEY }}
run: echo "VTORION=${{ steps.vt-orion.outputs.analysis }}" >> $GITHUB_ENV

- name: Download EeveeSpotify .deb file from releases
if: ${{ github.event.inputs.USEACTIONSEEVEE == 'false' }}
run: |
eevee_asset=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/releases/tags/${{ env.EEVEETAG }} | jq -r '.assets[] | select(.name | startswith("com.eevee.spotify") and endswith("iphoneos-arm64.deb")).browser_download_url')
eevee_asset=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/releases/tags/${{ env.EEVEETAG }} | jq -r '.assets[] | select(.name | startswith("com.eevee.spotify") and endswith("iphoneos-arm.deb")).browser_download_url')
echo "Downloading From: $eevee_asset"
# Download the file using curl
curl -LJO "$eevee_asset"
downloaded_file=$(ls -t | head -n1)
mv "$downloaded_file" "Build Components/"
echo "eevee-arm64=Build Components/$downloaded_file" >> $GITHUB_ENV
echo "eevee-arm=Build Components/$downloaded_file" >> $GITHUB_ENV
env:
EEVEETAG: ${{ env.EEVEETAG }}

Expand All @@ -200,9 +199,9 @@ jobs:
run: |
workflow_run_id=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ env.EEVEEREPO }}/actions/workflows/build-swift.yml/runs?status=success&per_page=1" | jq -r '.workflow_runs[0].id')
echo "Workflow ID: $workflow_run_id"
eevee_asset=$(curl -sL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/actions/runs/$workflow_run_id/artifacts | jq -r '.artifacts[] | select(.name | test("debug|arm.deb") | not) | .archive_download_url')
eevee_asset=$(curl -sL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/actions/runs/$workflow_run_id/artifacts | jq -r '.artifacts[] | select(.name | test("debug|arm64") | not) | .archive_download_url')
echo "Downloading From: $eevee_asset"
curl -LJ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$eevee_asset" -o "eeveespotfiyactionsasset.zip"
curl -LJ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$eevee_asset" -o "eeveespotfiyactionsasset.zip"
# Extract the downloaded zip file
unzip -q "eeveespotfiyactionsasset.zip" -d extracted_files
# Find the file you need within the extracted files
Expand All @@ -211,7 +210,7 @@ jobs:
mv "$downloaded_file" "Build Components/"
# Clean up extracted files
rm -rf extracted_files
echo "eevee-arm64=Build Components/$(basename "$downloaded_file")" >> $GITHUB_ENV
echo "eevee-arm=Build Components/$(basename "$downloaded_file")" >> $GITHUB_ENV
echo "eeveeAssetLink=$eevee_asset" >> $GITHUB_ENV
Expand All @@ -220,7 +219,7 @@ jobs:
uses: crazy-max/ghaction-virustotal@v4
id: vt-eevee
with:
files: "${{ env.eevee-arm64 }}"
files: "${{ env.eevee-arm }}"
vt_api_key: ${{ env.VIRUSTOTALKEY }}

- name: Get Eevee release name
Expand All @@ -234,15 +233,15 @@ jobs:

- name: Download SwiftProtobuf .deb file
run: |
protobuf_asset=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/releases/tags/${{ env.EEVEETAG }} | jq -r '.assets[] | select(.name | startswith("org.swift.protobuf.swiftprotobuf") and endswith("iphoneos-arm64.deb")).browser_download_url')
protobuf_asset=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/releases/tags/${{ env.EEVEETAG }} | jq -r '.assets[] | select(.name | startswith("org.swift.protobuf.swiftprotobuf") and endswith("iphoneos-arm.deb")).browser_download_url')
echo "Downloading From: $protobuf_asset"
# Download the file using curl
curl -LJO "$protobuf_asset"
downloaded_file=$(ls -t | head -n1)
mv "$downloaded_file" "Build Components/"
echo "swiftprotobuf=Build Components/$downloaded_file" >> $GITHUB_ENV
filename=$(basename "${protobuf_asset}")
protobuf_version=$(echo "${filename}" | sed -n 's/org.swift.protobuf.swiftprotobuf_\([^-]*\)_iphoneos-arm64.deb/\1/p')
protobuf_version=$(echo "${filename}" | sed -n 's/org.swift.protobuf.swiftprotobuf_\([^-]*\)_iphoneos-arm.deb/\1/p')
echo "SWIFTPROTOBUFVERSION=${protobuf_version}" >> $GITHUB_ENV
env:
EEVEETAG: ${{ env.EEVEETAG }}
Expand Down Expand Up @@ -275,9 +274,8 @@ jobs:
rm -f Info.plist
- name: Check if Vanilla Spotify was updated
run: |
echo "VANSPOTISUPDATED=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/SpotCompiled/SpotveeC/releases/latest | jq -r '.body' | grep -q "Spotify to version ${{ env.VANILLASPOTIFYVERSION }}" && echo false || echo true)" >> $GITHUB_ENV
run: echo "VANSPOTISUPDATED=$(curl -s https://api.github.com/repos/SpotCompiled/SpotveeC/releases/latest | jq -r '.body' | grep -q "Spotify to version ${{ env.VANILLASPOTIFYVERSION }}" && echo false || echo true)" >> $GITHUB_ENV

- name: Set Change Version
id: set-change-version
run: |
Expand Down Expand Up @@ -307,28 +305,28 @@ jobs:

- name: Run Pyzule
run: |
pyzule -i "${{ env.spotifypath }}" -o "${{ env.componentspath }}/SpotveeC.v${{ env.CHANGEVERSION }}_v${{ env.VANILLASPOTIFYVERSION }}.ipa" -v ${{ env.CHANGEVERSION }} -b com.yodaluca23.SpotveeC -f "${{ env.orion }}" "${{ env.swiftprotobuf }}" "${{ env.eevee-arm64 }}" -u -w -Nfix
pyzule -i "${{ env.spotifypath }}" -o "${{ env.componentspath }}/SpotveeC.v${{ env.CHANGEVERSION }}_v${{ env.VANILLASPOTIFYVERSION }}.ipa" -v ${{ env.CHANGEVERSION }} -b com.yodaluca23.SpotveeC -f "${{ env.orion }}" "${{ env.swiftprotobuf }}" "${{ env.eevee-arm }}" -u -w -Nfix
echo "patchedspotify=${{ env.componentspath }}/SpotveeC.v${{ env.CHANGEVERSION }}_v${{ env.VANILLASPOTIFYVERSION }}.ipa"
echo "patchedspotify=${{ env.componentspath }}/SpotveeC.v${{ env.CHANGEVERSION }}_v${{ env.VANILLASPOTIFYVERSION }}.ipa" >> $GITHUB_ENV
echo "Patched Spotify .ipa Located: $patchedspotify"
- name: Upload SpotifyPatched.ipa to VirusTotal
if: ${{ env.VIRUSTOTALKEY }}
uses: crazy-max/ghaction-virustotal@v4
id: vt-spotv
id: vt-spotc
with:
files: "${{ env.patchedspotify }}"
vt_api_key: ${{ env.VIRUSTOTALKEY }}

- name: Set VirusTotal Analysis URL for SpotVeeC
- name: Set VirusTotal Analysis URL for SpotveeC
if: ${{ env.VIRUSTOTALKEY }}
run: echo "VTSPOTV=${{ steps.vt-spotv.outputs.analysis }}" >> $GITHUB_ENV
run: echo "VTSPOTC=${{ steps.vt-spotc.outputs.analysis }}" >> $GITHUB_ENV

- name: Extract and Prepare VirusTotal Links
run: |
VTSPOTV=$(echo "$VTSPOTV" | sed 's/.*\(https:\/\/.*\)/\1/')
echo "SpotveeC VT: $VTSPOTV"
echo "VTSPOTV=$VTSPOTV" >> $GITHUB_ENV
VTSPOTC=$(echo "$VTSPOTC" | sed 's/.*\(https:\/\/.*\)/\1/')
echo "SpotveeC VT: $VTSPOTC"
echo "VTSPOTC=$VTSPOTC" >> $GITHUB_ENV
VTVANILLASPOTIFY=$(echo "$VTVANILLASPOTIFY" | sed 's/.*\(https:\/\/.*\)/\1/')
echo "Vanilla Spotify VT: $VTVANILLASPOTIFY"
echo "VTVANILLASPOTIFY=$VTVANILLASPOTIFY" >> $GITHUB_ENV
Expand All @@ -346,20 +344,21 @@ jobs:
run: |
echo "## ChangeLog" > changelog.txt
echo "- Updated [EeveeSpotify](https://github.com/${{ env.EEVEEREPO }}) to ${{ env.EEVEEVERSIONNAME }} </br>" >> changelog.txt
- name: Contruct ChangeLog Pt.2 (Eevee ChangeLog [Release])
if: ${{ github.event.inputs.USEACTIONSEEVEE == 'false' }}
run: |
echo "$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/releases/tags/${{ env.EEVEETAG }} | jq -r '.body' | sed -n 's/^\* //p' | sed 's/^/- (EeveeSpotify) /')" >> changelog.txt
- name: Contruct ChangeLog Pt.2 (Eevee ChangeLog [Actions])
if: ${{ github.event.inputs.USEACTIONSEEVEE == 'true' }}
run: |
echo "$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ env.EEVEEREPO }}/commits?since=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.EEVEEREPO }}/releases/latest | jq -r .published_at)" | jq -r '.[].commit.message' | grep -Ev "update: repo|Merge branch .+ of .+ into .+" | sed 's/^/- (EeveeSpotify) /')" >> changelog.txt
- name: Contruct ChangeLog Pt.3 (Spotify was updated? add to changelog)
if: ${{ env.VANSPOTISUPDATED == 'true' }}
run: echo "- Updated Spotify to version ${{ env.VANILLASPOTIFYVERSION }} </br>" >> changelog.txt
run: echo "- Updated Spotify to version ${{ env.VANILLASPOTIFYVERSION }} </br>" >> changelog.txt

- name: Contruct ChangeLog Pt.4 (Rest of changelog)
run: |
Expand All @@ -377,7 +376,7 @@ jobs:
if: ${{ github.event.inputs.USEACTIONSEEVEE == 'true' }}
run: |
assetnoZIP=$(echo "${{ env.eeveeAssetLink }}" | sed 's/\/zip$//')
RUN_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $assetnoZIP | jq -r .workflow_run.id)
RUN_ID=$(curl -s $assetnoZIP | jq -r .workflow_run.id)
eeveeUserAssetLink=$(echo "${{ env.eeveeAssetLink }}" | sed -E "s|https://api.github.com/repos/([^/]+)/([^/]+)/actions/artifacts/([0-9]+)/zip|https://github.com/\1/\2/actions/runs/${RUN_ID}/artifacts/\3|")
echo "The EeveeSpotify .deb was taken from the [latest Build workflow](${eeveeUserAssetLink})." >> changelog.txt
Expand All @@ -400,7 +399,7 @@ jobs:
echo "<p>SwiftProtobuf Framework Version: ${{ env.SWIFTPROTOBUFVERSION }}" >> changelog.txt
echo "<br><a href='${{ env.VTSWIFTPROTOBUF }}'>SwiftProtobuf Framework .deb VirusTotal</a></p>" >> changelog.txt
echo "<p>SpotveeC Version: v${{ env.CHANGEVERSION }}" >> changelog.txt
echo "<br><a href='${{ env.VTSPOTV }}'>SpotveeC VirusTotal</a></p>" >> changelog.txt
echo "<br><a href='${{ env.VTSPOTC }}'>SpotveeC VirusTotal</a></p>" >> changelog.txt
echo "</details>" >> changelog.txt
- name: Create Draft Release
Expand All @@ -421,7 +420,7 @@ jobs:
run: |
FILE_SIZE=$(stat -f%z "${{ env.patchedspotify }}")
echo "SpotveeC File Size: $FILE_SIZE"
echo "SPOTVSIZE=$FILE_SIZE" >> $GITHUB_ENV
echo "SPOTCSIZE=$FILE_SIZE" >> $GITHUB_ENV
- name: Fetch the first bullet point from the EeveeSpotify release changelog
id: fetch-changelog
Expand All @@ -438,10 +437,13 @@ jobs:
run: |
jq --arg CHANGEVERSION "${{ env.CHANGEVERSION }}" \
--arg CURRENTDATE "$(date +%Y-%-m-%d)" \
--arg SIZE "${{ env.SPOTVSIZE }}" \
--arg SIZE "${{ env.SPOTCSIZE }}" \
--arg ALTSTORECHANGELOG "${{ env.ALTSTORECHANGELOG }}" \
--arg VANILLASPOTIFYVERSION "${{ env.VANILLASPOTIFYVERSION }}" \
--arg EEVEEVERSIONNAME "${{ env.EEVEEVERSIONNAME }}" \
--arg SPOSIFYVERSION "${{ env.SPOSIFYVERSION }}" \
--arg EXTCOMMIT "${{ env.EXTCOMMIT }}" \
--arg SPOSIFYFIXVERSION "${{ env.SPOSIFYFIXVERSION }}" \
--arg ORIONVERSION "${{ env.ORIONVERSION }}" \
--arg SWIFTPROTOBUFVERSION "${{ env.SWIFTPROTOBUFVERSION }}" \
'
Expand Down

0 comments on commit 86e2dcb

Please sign in to comment.