Skip to content

Commit 1e03e25

Browse files
authored
Update schedule.yml
Now only produces Stable SnapEnhance Build's (v1.2.5+).
1 parent f848070 commit 1e03e25

File tree

1 file changed

+56
-24
lines changed

1 file changed

+56
-24
lines changed

.github/workflows/schedule.yml

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,82 @@ jobs:
1717

1818
- name: Set JAVA_HOME
1919
run: echo "JAVA_HOME=$(echo ${{ steps.setup-java.outputs.java-home }})" >> $GITHUB_ENV
20-
20+
2121
- name: Set up Node.js
2222
uses: actions/setup-node@v2
2323
with:
2424
node-version: 16
2525

26-
- name: Get Latest Artifact URL
27-
id: get_artifact
26+
- name: Check out code
27+
uses: actions/checkout@v2
28+
29+
- name: Install dependencies
2830
run: |
29-
repo_owner="rhunk"
30-
repo_name="SnapEnhance"
31-
workflow_name="beta.yml"
32-
pat="${{ secrets.SNAP_ENHANCE_WORKFLOW_ARTIFACT }}"
31+
sudo apt-get update
32+
sudo apt-get install -y jq curl
33+
shell: bash
3334

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

38-
download_url=$(curl -s -H "Authorization: Bearer $pat" \
39-
"$artifact_url" \
40-
| jq -r '.artifacts[0].archive_download_url')
38+
- name: Install pup
39+
run: |
40+
wget https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip -O pup.zip
41+
unzip pup.zip
42+
chmod +x pup
43+
sudo mv pup /usr/local/bin/
44+
working-directory: .
45+
46+
- name: Grant execute permissions to script
47+
run: chmod +x script.sh
48+
working-directory: .
49+
50+
- name: Run APK Download Script
51+
run: |
52+
./script.sh
53+
54+
- name: Fetch latest release information
55+
id: fetch-release
56+
run: |
57+
repo_owner="rhunk"
58+
repo_name="SnapEnhance"
59+
api_url="https://api.github.com/repos/${repo_owner}/${repo_name}/releases/latest"
60+
release_info=$(curl -s "$api_url")
61+
release_id=$(echo $release_info | jq -r '.id')
62+
release_tag_name=$(echo $release_info | jq -r '.tag_name')
4163
42-
echo "Artifact URL: $artifact_url"
43-
echo "Download URL: $download_url"
64+
# Find the asset URL for APK files
65+
asset_url=""
66+
for asset in $(echo $release_info | jq -c '.assets[]'); do
67+
asset_name=$(echo $asset | jq -r '.name')
68+
if [[ $asset_name == *"armv8"* && $asset_name == *".apk" ]]; then
69+
asset_url=$(echo $asset | jq -r '.browser_download_url')
70+
break
71+
fi
72+
done
4473
45-
echo "download_url=$download_url" >> $GITHUB_ENV
74+
echo "release_id=$release_id" >> $GITHUB_ENV
75+
echo "release_tag_name=$release_tag_name" >> $GITHUB_ENV
76+
echo "asset_url=$asset_url" >> $GITHUB_ENV
4677
shell: bash
4778

48-
- name: Download Latest core.apk
79+
- name: Download the latest APK
4980
run: |
50-
download_url="${{ env.download_url }}"
51-
wget "$download_url" -O "$GITHUB_WORKSPACE/core.apk"
52-
81+
release_id="${{ env.release_id }}"
82+
asset_url="${{ env.asset_url }}"
83+
release_tag_name="${{ env.release_tag_name }}"
84+
wget "$asset_url" -O "$GITHUB_WORKSPACE/latest-snapenhance-${release_tag_name}.apk"
85+
shell: bash
86+
5387
- name: Run the command
5488
run: |
55-
java -jar lspatch.jar -m "$GITHUB_WORKSPACE/core.apk" -f -l 2 -v snap.apk
89+
java -jar lspatch.jar -m latest-snapenhance-${release_tag_name}.apk -f -l 2 -v snap.apk
5690
5791
- name: Upload artifact
5892
uses: actions/upload-artifact@v2
5993
with:
6094
name: snap-360-lspatched.apk
6195
path: ./snap-360-lspatched.apk
62-
6396
- name: Check if the release already exists
6497
id: check_release
6598
run: |
@@ -70,10 +103,9 @@ jobs:
70103
RELEASE_VERSION=$(echo $RELEASE_VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./')
71104
fi
72105
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
73-
74106
- name: Create or Update Release
75107
id: create_release
76108
uses: softprops/action-gh-release@v1
77109
with:
78110
files: snap-360-lspatched.apk
79-
tag_name: ${{ env.RELEASE_VERSION }}
111+
tag_name: ${{ env.RELEASE_VERSION }}-Stable # Append "-Stable" to the tag name

0 commit comments

Comments
 (0)