Skip to content

Commit cdb2aa5

Browse files
authored
Update main.yml
1 parent 6f7aa22 commit cdb2aa5

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,49 @@ name: Deploy NetSec to GitHub Pages
33
on:
44
push:
55
branches:
6-
- main # Change this if your default branch is different
7-
6+
- main # Adjust if your default branch is different
87
pull_request:
98
branches:
109
- main
1110

12-
workflow_dispatch: # Allows manual trigger
13-
14-
permissions:
15-
contents: read
16-
pages: write
17-
id-token: write
18-
1911
jobs:
20-
build:
12+
deploy:
2113
runs-on: ubuntu-latest
22-
2314
steps:
2415
- name: Checkout Repository
2516
uses: actions/checkout@v4
2617

2718
- name: Set up Python
2819
uses: actions/setup-python@v4
2920
with:
30-
python-version: '3.x' # Ensure correct Python version
21+
python-version: '3.x'
3122

3223
- name: Install Dependencies
33-
run: pip install -r requirements.txt
34-
35-
- name: Generate Static Files
3624
run: |
37-
mkdir -p build
38-
echo "<h1>NetSec Scanner Deployment</h1><p>This is a placeholder page until proper hosting is configured.</p>" > build/index.html
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
3927
40-
- name: Upload GitHub Pages Artifact
41-
uses: actions/upload-pages-artifact@v1
42-
with:
43-
path: build
28+
- name: Install Streamlit & Dependencies
29+
run: |
30+
pip install streamlit
4431
45-
deploy:
46-
needs: build
47-
runs-on: ubuntu-latest
48-
environment:
49-
name: github-pages
50-
url: ${{ steps.deployment.outputs.page_url }}
32+
- name: Create Streamlit Config for GitHub Pages
33+
run: |
34+
mkdir -p ~/.streamlit/
35+
echo "[server]" > ~/.streamlit/config.toml
36+
echo "headless = true" >> ~/.streamlit/config.toml
37+
echo "port = \$PORT" >> ~/.streamlit/config.toml
38+
echo "enableCORS = false" >> ~/.streamlit/config.toml
39+
echo "[theme]" >> ~/.streamlit/config.toml
40+
echo "base = 'light'" >> ~/.streamlit/config.toml
5141
52-
steps:
5342
- name: Deploy to GitHub Pages
54-
id: deployment
55-
uses: actions/deploy-pages@v2
43+
uses: peaceiris/actions-gh-pages@v4
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
publish_dir: ./ # Streamlit runs from the root directory
47+
48+
- name: Run Streamlit App (Debugging Purpose)
49+
run: |
50+
streamlit run NetSec.py &
51+
sleep 10

0 commit comments

Comments
 (0)