Skip to content

Commit ec76d8e

Browse files
authored
Merge pull request #202 from neural-loop/main
Prevent Search Indexing of Github Pages used as staging sites: .htaccess and robotx.txt applied for non onm domains
2 parents 093b6df + cf4f600 commit ec76d8e

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/main.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ on:
44
push:
55
branches: ["main"]
66

7-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
87
permissions:
98
contents: read
109
pages: write
1110
id-token: write
1211

13-
# Environment variables available to all jobs and steps in this workflow
1412
env:
1513
HUGO_ENV: production
1614
HUGO_VERSION: "0.118.2"
1715
GO_VERSION: "1.20.5"
1816
NODE_VERSION: "18.15.0"
1917

2018
jobs:
21-
# Build job
2219
build:
2320
runs-on: ubuntu-24.04-arm
2421
steps:
@@ -65,15 +62,35 @@ jobs:
6562
6663
- name: Modify hugo.toml
6764
run: sed -i "s|baseURL = .*|baseURL = \"$BASE_URL\"|" hugo.toml
65+
66+
- name: Create public directory
67+
run: mkdir -p public
68+
69+
- name: Create .htaccess (if needed)
70+
run: touch public/.htaccess
71+
6872
- name: Build site
6973
run: npm run build
7074

75+
- name: Modify .htaccess (Prevent Indexing)
76+
run: |
77+
if [[ "$BASE_URL" != "https://open-neuromorphic.org/" ]]; then
78+
sudo chmod 666 public/.htaccess
79+
echo "Header set X-Robots-Tag \"noindex, nofollow\"" >> public/.htaccess
80+
fi
81+
82+
- name: Create robots.txt (Prevent Indexing)
83+
run: |
84+
if [[ "$BASE_URL" != "https://open-neuromorphic.org/" ]]; then
85+
echo "User-agent: *" > public/robots.txt
86+
echo "Disallow: /" >> public/robots.txt
87+
fi
88+
7189
- name: Upload artifact
7290
uses: actions/upload-pages-artifact@v3.0.1
7391
with:
7492
path: ./public
7593

76-
# Deployment job
7794
deploy:
7895
environment:
7996
name: github-pages

0 commit comments

Comments
 (0)