Skip to content

Commit

Permalink
Update schedule.yml
Browse files Browse the repository at this point in the history
Now only produces Stable SnapEnhance Build's (v1.2.5+).
  • Loading branch information
ABCPascal authored Dec 30, 2023
1 parent f848070 commit 1e03e25
Showing 1 changed file with 56 additions and 24 deletions.
80 changes: 56 additions & 24 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,82 @@ jobs:

- name: Set JAVA_HOME
run: echo "JAVA_HOME=$(echo ${{ steps.setup-java.outputs.java-home }})" >> $GITHUB_ENV

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: Get Latest Artifact URL
id: get_artifact
- name: Check out code
uses: actions/checkout@v2

- name: Install dependencies
run: |
repo_owner="rhunk"
repo_name="SnapEnhance"
workflow_name="beta.yml"
pat="${{ secrets.SNAP_ENHANCE_WORKFLOW_ARTIFACT }}"
sudo apt-get update
sudo apt-get install -y jq curl
shell: bash

artifact_url=$(curl -s -H "Authorization: Bearer $pat" \
"https://api.github.com/repos/${repo_owner}/${repo_name}/actions/workflows/${workflow_name}/runs?status=success&per_page=1" \
| jq -r '.workflow_runs[0].artifacts_url')
- name: Install unzip
run: sudo apt-get install unzip -y

download_url=$(curl -s -H "Authorization: Bearer $pat" \
"$artifact_url" \
| jq -r '.artifacts[0].archive_download_url')
- name: Install pup
run: |
wget https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip -O pup.zip
unzip pup.zip
chmod +x pup
sudo mv pup /usr/local/bin/
working-directory: .

- name: Grant execute permissions to script
run: chmod +x script.sh
working-directory: .

- name: Run APK Download Script
run: |
./script.sh
- name: Fetch latest release information
id: fetch-release
run: |
repo_owner="rhunk"
repo_name="SnapEnhance"
api_url="https://api.github.com/repos/${repo_owner}/${repo_name}/releases/latest"
release_info=$(curl -s "$api_url")
release_id=$(echo $release_info | jq -r '.id')
release_tag_name=$(echo $release_info | jq -r '.tag_name')
echo "Artifact URL: $artifact_url"
echo "Download URL: $download_url"
# Find the asset URL for APK files
asset_url=""
for asset in $(echo $release_info | jq -c '.assets[]'); do
asset_name=$(echo $asset | jq -r '.name')
if [[ $asset_name == *"armv8"* && $asset_name == *".apk" ]]; then
asset_url=$(echo $asset | jq -r '.browser_download_url')
break
fi
done
echo "download_url=$download_url" >> $GITHUB_ENV
echo "release_id=$release_id" >> $GITHUB_ENV
echo "release_tag_name=$release_tag_name" >> $GITHUB_ENV
echo "asset_url=$asset_url" >> $GITHUB_ENV
shell: bash

- name: Download Latest core.apk
- name: Download the latest APK
run: |
download_url="${{ env.download_url }}"
wget "$download_url" -O "$GITHUB_WORKSPACE/core.apk"
release_id="${{ env.release_id }}"
asset_url="${{ env.asset_url }}"
release_tag_name="${{ env.release_tag_name }}"
wget "$asset_url" -O "$GITHUB_WORKSPACE/latest-snapenhance-${release_tag_name}.apk"
shell: bash

- name: Run the command
run: |
java -jar lspatch.jar -m "$GITHUB_WORKSPACE/core.apk" -f -l 2 -v snap.apk
java -jar lspatch.jar -m latest-snapenhance-${release_tag_name}.apk -f -l 2 -v snap.apk
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: snap-360-lspatched.apk
path: ./snap-360-lspatched.apk

- name: Check if the release already exists
id: check_release
run: |
Expand All @@ -70,10 +103,9 @@ jobs:
RELEASE_VERSION=$(echo $RELEASE_VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./')
fi
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Create or Update Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: snap-360-lspatched.apk
tag_name: ${{ env.RELEASE_VERSION }}
tag_name: ${{ env.RELEASE_VERSION }}-Stable # Append "-Stable" to the tag name

0 comments on commit 1e03e25

Please sign in to comment.