Generate new Article for AI #45
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: Generate new Article for AI | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * 0" | |
| jobs: | |
| aibuild: | |
| name: Re-create AI data. | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: executing remote ssh commands using password | |
| uses: appleboy/ssh-action@v0.1.8 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| port: ${{ secrets.PORT }} | |
| script: | | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
| [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
| nvm use 20 | |
| cd /home/saahild.com/public_html/ai-blog/scripts | |
| npm init -y | |
| npm install openai | |
| OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} OUT_DIR=/home/saahild.com/public_html/ai-blog/ node create_blog.js | |
| rm -rf node_modules package.json package-lock.json |