Testing Streamlit app with Github Actions

I have a Streamlit .py file hosted on a GitHub repository, aimed at managing versions and incorporating changes from various developers. Beyond version control, I seek to automate the deployment process, ensuring that updates made by developers on the GitHub repository reflect promptly on the application’s server and frontend without the need for manual intervention.

To achieve this automation, I’ve explored creating a GitHub Actions workflow triggered by pushes to the master branch. In this YAML file, I aim to execute the command “streamlit run ‘pathtopythonfileongithub’ --server.address localhost --server.port 8600”. While this command executes successfully in the VScode terminal, embedding it in the YAML file should ideally reflect changes in my browser upon pushing the file to the GitHub repository.

However, encountering a roadblock, the deployed server remains inaccessible when attempting to access localhost:8600 in my browser. Upon modifying the localhost address to my machine’s IP, the workflow fails with the error message: “cannot assign this IP.” Below is the YAML file:
name: ci-cd-streamlit

- master

runs-on: ubuntu-latest
- name: Checkout code
uses: actions/checkout@v4

  - name: Install dependencies
    run: pip install streamlit

  - name: Deploy code
      SERVER_IP: localhost
      PORT: 8600
    run: |
      streamlit run https://github.com/adebayodeji/test_streamlit_app/blob/master/CICD_Test1.py --server.address localhost  --server.port 8600
  - name: start local server
    run: |
      python -m http.server 8600

N:B For test purpose, my goal is to make my machine the server for deployment, hence why I am using localhost in the yaml file. If this work well for me, then I can advise the team to use a proper server to host the application or for deployment.
I seek guidance on resolving the deployment issue to ensure seamless integration of changes from the GitHub repository to the application’s server and frontend.
Thanks in anticipation of your response.