Upload random post to youtube #15
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: Upload random post to youtube | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Every hour | |
| workflow_dispatch: | |
| inputs: | |
| postId: | |
| description: "optional reddit post id" | |
| required: false | |
| default: "" | |
| jobs: | |
| upload: | |
| runs-on: ubuntu-latest | |
| environment: upload | |
| env: | |
| REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }} | |
| REDDIT_CLIENT_SECRET: ${{ secrets.REDDIT_CLIENT_SECRET }} | |
| REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }} | |
| REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }} | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
| GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
| GOOGLE_ACCESS_TOKEN: ${{ secrets.GOOGLE_ACCESS_TOKEN }} | |
| GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }} | |
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
| TIKTOK_SESSION_ID: ${{ secrets.TIKTOK_SESSION_ID }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up bun | |
| uses: oven-sh/setup-bun@v1 | |
| - name: Install dependencies | |
| run: bun install | |
| # 4. Install system libs Puppeteer's Chromium needs | |
| - name: Install Puppeteer dependencies | |
| run: | | |
| sudo add-apt-repository ppa:tomtomtom/yt-dlp # Add ppa repo to apt | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 \ | |
| libxfixes3 libxi6 libxtst6 libnss3 libglib2.0-0 libgtk-3-0t64 \ | |
| libasound2t64 libxrandr2 libpangocairo-1.0-0 libatk1.0-0 \ | |
| libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 \ | |
| libgdk-pixbuf2.0-0 yt-dlp ffmpeg | |
| - name: Manual trigger (with postId) | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.postId != '' }} | |
| run: | | |
| echo "Manual trigger detected with postId: ${{ github.event.inputs.postId }}" | |
| bun src/cli.ts -p ${{github.event.inputs.postId}} -u youtube | |
| - name: Manual trigger (without postId) | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.postId == '' }} | |
| run: | | |
| echo "Manual trigger detected without postId" | |
| bun src/cli.ts -r -u youtube | |
| - name: Run CLI normally (no postId) | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.postId == '' }} | |
| run: | | |
| echo "Running default flow (scheduled or manual without postId)" | |
| bun src/cli.ts -r -u youtube |