Build, Create Post and Publish it #102
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: Build, Create Post and Publish it | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Create .env file | |
run: | | |
echo "MEDIUM_ACCESS_TOKEN=${{ secrets.MEDIUM_ACCESS_TOKEN }}" >> ./config/.env | |
echo "OPENAI_MODEL_NAME=${{ secrets.OPENAI_MODEL_NAME }}" >> ./config/.env | |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> ./config/.env | |
echo "DEBUG=${{ secrets.DEBUG }}" >> ./config/.env | |
shell: bash | |
- name: Create Google Services JSON File | |
env: | |
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }} | |
run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./credential/gcloud.json | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Install dependencies | |
run: poetry install | |
- name: Run tests or other commands | |
run: | | |
poetry run python main.py --topics ${{ secrets.TOPICS }} --publish_status ${{ secrets.PUBLISH_STATUS }} | |
shell: bash |