Skip to content

Commit f0447c1

Browse files
Add script to deploy from local environment
1 parent fefb626 commit f0447c1

3 files changed

Lines changed: 42 additions & 13 deletions

File tree

.github/workflows/main.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ jobs:
6363

6464
steps:
6565
- name: Checkout repository
66-
uses: actions/checkout@v1
66+
uses: actions/checkout@v4
6767
with:
68-
fetch-depth: 1
68+
ref: gh-pages
6969

7070
- name: Download artifact
7171
uses: actions/download-artifact@v3
@@ -79,14 +79,7 @@ jobs:
7979
8080
- name: Deploy to gh-pages branch
8181
run: |
82-
git config user.name "${GITHUB_ACTOR}"
83-
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
84-
git checkout --orphan gh-pages
85-
git reset --hard
86-
mv site/* .
87-
rm -rf site
88-
git clean -fdx
89-
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
90-
git add .
91-
git commit -m "Deploy documentation to gh-pages"
92-
git push --force $remote_repo gh-pages
82+
# git config user.name "${GITHUB_ACTOR}"
83+
# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
84+
85+
tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ venv
33
.build
44
.env
55
site.zip
6+
deploy
67

78
# temporary
89
rodi

deploy.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# For the maintainer having the necessary rights to publish from the local
2+
# dev environment...
3+
4+
if [[ ! -d "site" ]]; then
5+
echo -e "\033[31mError: 'site' folder does not exist. Aborting.\033[0m"
6+
exit 1
7+
fi
8+
9+
read -p "Are you sure you want to proceed? (y/n): " confirmation
10+
11+
if [[ "$confirmation" =~ ^[Yy]$ ]]; then
12+
echo "Deploying..."
13+
14+
rm -rf deploy
15+
mkdir deploy
16+
cd deploy
17+
18+
git clone -b gh-pages git@github.com:Neoteroi/neoteroi.github.io.git copy
19+
20+
cp copy/CNAME ../site/
21+
cp copy/README.md ../site/
22+
23+
rm -rf copy/*
24+
cp -r ../site/* copy/
25+
26+
cd copy/
27+
git add .
28+
git commit -m "Deploy documentation on $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
29+
git push origin gh-pages --force
30+
31+
echo "Published to gh-pages"
32+
else
33+
echo "Operation canceled."
34+
exit 1
35+
fi

0 commit comments

Comments
 (0)