WhatsApp Bot #327
This file contains hidden or 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: WhatsApp Bot | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| run-bot: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - name: Install System Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| ffmpeg \ | |
| python3 \ | |
| python3-pip \ | |
| python-is-python3 | |
| - name: Install Google Chrome | |
| run: | | |
| # 1. Update and install prerequisites | |
| sudo apt-get update # refresh package lists :contentReference[oaicite:3]{index=3} | |
| sudo apt-get install -y curl gnupg ca-certificates # for key handling :contentReference[oaicite:4]{index=4} | |
| # 2. Retrieve and dearmor Google’s signing key | |
| sudo mkdir -p /etc/apt/keyrings # ensure keyring dir :contentReference[oaicite:5]{index=5} | |
| curl -fsSL https://dl.google.com/linux/linux_signing_key.pub \ | |
| | gpg --dearmor \ | |
| | sudo tee /etc/apt/keyrings/google.gpg > /dev/null # write key under sudo :contentReference[oaicite:6]{index=6} | |
| # 3. Add Chrome APT repository | |
| echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google.gpg] \ | |
| http://dl.google.com/linux/chrome/deb/ stable main" \ | |
| | sudo tee /etc/apt/sources.list.d/google-chrome.list # proper tee usage :contentReference[oaicite:7]{index=7} | |
| # 4. Install Chrome | |
| sudo apt-get update # pick up new repo :contentReference[oaicite:8]{index=8} | |
| sudo apt-get install -y google-chrome-stable # install stable channel :contentReference[oaicite:9]{index=9} | |
| # 5. Clean up | |
| sudo rm -rf /var/lib/apt/lists/* # reduce runner footprint :contentReference[oaicite:10]{index=10} | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Run Bot | |
| env: | |
| MONGO_URI: ${{ secrets.MONGO_URI }} | |
| GITTOKEN: ${{ secrets.GITTOKEN }} | |
| run: npm start |