DumprX #1634
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DumprX | |
on: | |
workflow_dispatch: | |
inputs: | |
ROM_URL: | |
description: "Direct Link of the ROM/Firmware to Dump" | |
required: true | |
# Requester | |
USER_NAME: | |
description: "Telegram Username of Who Requested The Dump" | |
required: false | |
EXTRA_CMD: | |
description: "Any Extra Command to Run Before Dump" | |
required: false | |
defaults: | |
run: | |
shell: bash | |
env: | |
# ROM | |
ROM_URL: ${{ github.event.inputs.ROM_URL }} | |
# Requester | |
USERNAME: ${{ github.event.inputs.USERNAME }} | |
# Gitlab | |
PUSH_TO_GITLAB: true | |
# Extra Command | |
EXTRA_CMD: ${{ github.event.inputs.EXTRA_CMD }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Workflow URL | |
run: | | |
WORKFLOW_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
echo "WORKFLOW_URL=$WORKFLOW_URL" >> $GITHUB_ENV | |
- name: Give the user the run link | |
run: | | |
curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage -d chat_id=${{ secrets.GROUP_CHAT_ID }} -d text="Follow progress here: $WORKFLOW_URL" | |
# Cleanup The Actions Workspace Using Custom Composite Run Actions | |
- name: Cleanup | |
uses: rokibhasansagar/slimhub_actions@main | |
- name: Checkouts | |
uses: actions/checkout@v2 | |
- name: Clone Our Firmware Dumper | |
run: | | |
git clone https://github.com/DumprX/DumprX.git DumprX | |
- name: Setup DumprX's Environment | |
working-directory: DumprX | |
run: | | |
sudo bash setup.sh | |
sudo apt install -y f2fs-tools | |
sudo apt install neofetch -y | |
mkdir -p ~/.ssh | |
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts | |
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts | |
git config --global user.name "atharvnegi" | |
git config --global user.email "[email protected]" | |
- name: Setup Config envs | |
working-directory: DumprX | |
run: | | |
# echo "${{ secrets.GIT_TOKEN }}" > .github_token | |
# echo "${{ secrets.GIT_ORG_NAME }}" > .github_orgname | |
echo "${{ secrets.GITLAB_TOKEN }}" > .gitlab_token # Only for Gitlab | |
echo "${{ secrets.GITLAB_GROUP }}" > .gitlab_group # Only for Gitlab | |
echo "${{ secrets.GITLAB_INSTANCE }}" > .gitlab_instance # Only for Gitlab | |
echo "${{ secrets.PRIV_SSH_KEY }}" > ~/.ssh/id_rsa # Only for Gitlab | |
echo "${{ secrets.BOT_TOKEN }}" > .tg_token | |
echo "${{ secrets.CHAT_ID }}" > .tg_chat | |
chmod 600 ~/.ssh/id_rsa | |
if grep -q "HOST \*" ~/.ssh/config && grep -q "StrictHostKeyChecking no" ~/.ssh/config; then | |
echo "Changes are already present" | |
else | |
echo "HOST *" > ~/.ssh/config | |
echo "StrictHostKeyChecking no" >> ~/.ssh/config | |
fi | |
- name: Run the Extra Command | |
working-directory: DumprX | |
run: | | |
$EXTRA_CMD | |
- name: Start Dumping | |
working-directory: DumprX | |
run: | | |
./dumper.sh "$ROM_URL" | |
- name: Telegram Notification | |
if: ${{ cancelled() || failure() }} | |
continue-on-error: true | |
uses: xinthink/[email protected] | |
with: | |
chatId: ${{ secrets.GROUP_CHAT_ID }} | |
botToken: ${{ secrets.TELEGRAM_TOKEN }} | |
jobStatus: ${{ job.status }} | |
skipSuccess: true |