Goat / Floppa Bot Runner #20
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: Goat / Floppa Bot Runner | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| node_version: | |
| description: 'Node.js version' | |
| required: false | |
| type: choice | |
| options: | |
| - '22' | |
| - '20' | |
| default: '22' | |
| jobs: | |
| build-and-run: | |
| name: Run Floppa Bot Runner | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source Code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ inputs.node_version || '22' }} | |
| - name: Install System Native Build Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev | |
| - name: Cache Node Modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install Dependencies | |
| run: npm install && npm rebuild sqlite3 canvas bcrypt | |
| - name: Configure Credentials If Provided | |
| env: | |
| FB_STATE: ${{ secrets.FB_STATE }} | |
| ACCOUNT_TXT: ${{ secrets.ACCOUNT_TXT }} | |
| run: | | |
| if [ -n "$FB_STATE" ]; then | |
| printf '%s\n' "$FB_STATE" > account.txt | |
| echo "Loaded Facebook credentials from FB_STATE secret." | |
| elif [ -n "$ACCOUNT_TXT" ]; then | |
| printf '%s\n' "$ACCOUNT_TXT" > account.txt | |
| echo "Loaded Facebook credentials from ACCOUNT_TXT secret." | |
| fi | |
| if [ -s account.txt ]; then | |
| echo "account.txt is present and configured ($(wc -c < account.txt) bytes)" | |
| else | |
| echo "account.txt will be loaded from repository or environment fallback." | |
| fi | |
| - name: Start the Bot | |
| env: | |
| PORT: 5000 | |
| NODE_ENV: production | |
| FB_STATE: ${{ secrets.FB_STATE }} | |
| ACCOUNT_TXT: ${{ secrets.ACCOUNT_TXT }} | |
| run: npm start |