Mongo DB + Streamlit + github actions

22 Views Asked by At

I am integrating mongoDB with streamlit ! so to store MONGO secrets I am using github actions. I have only one problem.

I am not able to read those secrets. in my python file. I have mostly tried everything. so last option i am trying to do is run directly from workflow .YAML file. like a command line file with ARGS.

#this is the yaml I am using 
name: run python script
on:
  push:
    branches: [shyam]

env:
  USERNAME: ${{secrets.USERNAME}}
  PASSWORD: ${{secrets.PASSWORD}}

jobs:
  run-python:
    runs-on: ubuntu-latest
    steps:
      - name: checkout code
        uses: actions/checkout@v3
  - name: setup python
    uses: actions/setup-python@v4
    with:
      python-version: "3.11"

  - name: install dependencies
    run: |
      pip install -r requirements.txt
  - name: run streamlit
    run:
      streamlit run main.py ${{secrets.USERNAME}} ${{secrets.PASSWORD}}

I am trying to use my secrets as cmd args in yml file only.

can someone help me out.

note- I do not want to use heroku to do this neither docker. I need streamlit to work with actions.

I have tried to directly use os.environ(USERNAME) in python file from the declared ENV in YAML, but it does not work, I am not able to access my pass and username to connect to my MONGODB.

0

There are 0 best solutions below