Skip to content

Commit 403473d

Browse files
committed
Workflow - Github
1 parent c216feb commit 403473d

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Zola Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout source
13+
uses: actions/checkout@v4
14+
with:
15+
submodules: recursive
16+
17+
# Install dependencies
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y curl unzip rsync git
22+
23+
# Install Zola
24+
- name: Install Zola
25+
run: |
26+
curl -s -L https://github.com/getzola/zola/releases/download/v0.21.0/zola-v0.21.0-x86_64-unknown-linux-musl.tar.gz \
27+
| sudo tar xvzf - -C /usr/local/bin
28+
zola --version
29+
30+
# Build site
31+
- name: Build site
32+
run: zola build --output-dir publish_tmp --force
33+
34+
# Deploy to submodule repo
35+
- name: Deploy to public submodule
36+
env:
37+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
38+
run: |
39+
TIMESTAMP=$(date '+%Y-%m-%d %I:%M:%S %p')
40+
rsync -av --delete --exclude='.git' --exclude="CNAME" publish_tmp/ public/
41+
cd public
42+
git checkout main
43+
git pull origin main
44+
git add .
45+
git commit -m "Automated Deploy: $TIMESTAMP" || echo "No changes to deploy."
46+
git push https://tr1xem:${GH_TOKEN}@github.com/tr1xem/tr1xem.github.io.git main
47+
cd ..
48+
49+
# Commit source repo changes if any
50+
- name: Commit source repo
51+
env:
52+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
53+
run: |
54+
TIMESTAMP=$(date '+%Y-%m-%d %I:%M:%S %p')
55+
git add .
56+
git commit -m "Automated Commit: $TIMESTAMP" || echo "No source changes."
57+
git push https://${GH_TOKEN}@github.com/tr1xem/tr1xem.git main
File renamed without changes.

0 commit comments

Comments
 (0)