Skip to content

Commit

Permalink
Create shrpci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rxuglr authored Jan 27, 2023
1 parent 7eb7dab commit 6fdd44e
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/shrpci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: SHRP CI
on:
workflow_dispatch:
inputs:
OFFICIAL_BUILD:
description: 'set true if you wanna push Official Build'
required: false
env:
MANIFEST: "https://github.com/SHRP/manifest -b shrp-12.1"
# Recovery Manifest URL with -b branch
DT_LINK: "https://github.com/SHRP-Devices/device_xiaomi_surya"
# Your Device Tree Link
VENDOR: "xiaomi"
# Your Device's Vendor name as in used inside DT. Example: xiaomi, samsung, asus, etc.
CODENAME: "surya"
# Your Device's Codename as in used inside DT." Example: nikel, phoenix, ginkgo, etc.
KERNEL_LINK: ""
# Kernel repo link with optional -b branch. Only for building kernel from source. Ignore if using prebuilt.
TARGET: "recoveryimage"
# Set as recoveryimage (or bootimage if no recovery partition avaiable)
FLAVOR: "eng"
# eng by default, change the variable if you want userdebug
SOURCE: "twrp"
# Set as omni (or twrp if using v3_11.0)
EXTRA_CMD: ""
# For qualcomm FDE devices put git clone https://github.com/omnirom/android_vendor_qcom_opensource_commonsys --depth=1 -b android-9.0 vendor/qcom/opensource/commonsys in EXTRA CMD
# If you want to Execute any external Command Before Compilation Starts
TZ: "Asia/Kolkata"
TOKEN: ${{ secrets.BOTTOKEN }}
OFFICIAL_BUILD: ${{ github.event.inputs.OFFICIAL_BUILD }}

jobs:
shrpCI:
runs-on: ubuntu-20.04

steps:
- name: Cleaning Up Runner
uses: rokibhasansagar/slimhub_actions@main

- name: Recovery Compilation
uses: SHRP-Devices/Recovery-Compiler@release

- name: Uploading SHRP Build
run: |
cd ${BuildPath}/out/target/product/${CODENAME}/
curl -sL https://git.io/file-transfer | sh
./transfer wet *SHRP*.zip
./transfer wet *Addon*.zip
- name: PUSH To TG
run: |
cd ${BuildPath}/out/target/product/${CODENAME}/
ZIP=$(echo *stable*.zip)
sudo zip -r9 TestBuild_"${CODENAME}" $ZIP
ZIPs=$(echo TestBuild_"${CODENAME}".zip)
curl -F document=@$ZIPs "https://api.telegram.org/bot$TOKEN/sendDocument" \
-F chat_id="-1001296548298" \
-F "disable_web_page_preview=true" \
-F "parse_mode=html" \
-F caption=" <i> SHRP Recovery </i> for <b> '$VENDOR' '$CODENAME' </b> is Available for Testing Purposes Only | Build finished on <b> $(date) </b> | <i> #SHRP Recovery </i> "
ZIP=$(echo *AddonRescue*.zip)
curl -F document=@$ZIP "https://api.telegram.org/bot$TOKEN/sendDocument" \
-F chat_id="-1001296548298" \
-F "disable_web_page_preview=true" \
-F "parse_mode=html" \
-F caption=" <i> SHRP AddOnRescue </i> for <b> '$VENDOR' '$CODENAME' </b> | <i> #SHRP Recovery </i> "
- name: Pushing Build To SourceForge
run: |
if [[ "$OFFICIAL_BUILD" == "true" ]]; then
printf "Uploading to SourceForge\n"
cd ${BuildPath}/out/target/product/${CODENAME}/
sudo apt-get update -y && sudo apt-get install expect -y
expect -c '
spawn sftp ${{ secrets.SFUSER }}@frs.sourceforge.net
expect \"yes/no\"
send "yes\r"
expect \"Password\"
send "${{ secrets.SFPASS }}\r"
expect \"sftp> \"
send "cd /home/frs/project/shrp/$::env(CODENAME)/\r"
set timeout -1
send "put *stable*.zip\r"
expect "Uploading"
expect "*100%*"
expect "sftp*"
send "put *AddonRescue*.zip\r"
expect "Uploading"
expect "*100%*"
expect "sftp*"
send "bye\r"
interact
'
else
printf "Uploading to SourceForge\n"
cd ${BuildPath}/out/target/product/${CODENAME}/
sudo apt-get update -y && sudo apt-get install expect -y
expect -c '
spawn sftp ${{ secrets.SFUSER }}@frs.sourceforge.net
expect \"yes/no\"
send "yes\r"
expect \"Password\"
send "${{ secrets.SFPASS }}\r"
expect \"sftp> \"
send "cd /home/frs/project/shrp/test/\r"
set timeout -1
send "put *stable*.zip\r"
expect "Uploading"
expect "*100%*"
expect "sftp*"
send "bye\r"
interact
'
fi

0 comments on commit 6fdd44e

Please sign in to comment.