-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (132 loc) ยท 5.02 KB
/
Copy pathhexo-deploy.yml
File metadata and controls
148 lines (132 loc) ยท 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: ๐ธโจ Hexo to gh-pages UwU โจ๐ธ
on:
push:
branches:
- main # ๐ main branch uwu
workflow_dispatch: # ๐ฑ๏ธ manual trigger nyan~
schedule:
- cron: '0 0 * * *' # โฐ๐ Nightly buildies ~nyan! ๐พ (โฟโ โฟโ )
jobs:
build:
name: ๐๏ธ Build UwU
permissions:
contents: read
runs-on: ubuntu-latest # ๐ง๐
steps:
- name: ๐ฆ๐ Checkout Code OwO
uses: actions/checkout@v4
with:
token: ${{ secrets.FINE_GRAINED_PAT }}
submodules: recursive
- name: ๐จ๐ฟ Check for Theme Updates nya~
run: |
git submodule update --init --recursive
cd themes/cactus
DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
git fetch origin $DEFAULT_BRANCH
git reset --hard origin/$DEFAULT_BRANCH
cd ../..
if [ -n "$(git status -s)" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add themes/cactus
# โจ Random kawaii commit messages โจ
MESSAGES=(
"๐ธโจ Updated theme to latest nya~ (โงฯโฆ)๐"
"๐ UwU Theme update desu! โจ nyaaa~ (โฟโ โฟโ )๐"
"๐พ๐ก Theme go brrr~ updated to freshy fresh โจ owo (๏ฝก>๏น<๏ฝก)๐"
"๐โจ Theme update complete UwU ~nya nya (โงโกโฆ)โง"
"๐๐ธ Senpai~ I updated the theme for you (โฟโฅโฟโฅ) โจ"
)
RANDOM_MSG=${MESSAGES[$RANDOM % ${#MESSAGES[@]}]}
git commit -am "$RANDOM_MSG"
git remote set-url origin https://${{ secrets.FINE_GRAINED_PAT }}@github.com/BrokenBotnet/brokenbotnet.github.io.git
git push
fi
continue-on-error: true
- name: ๐๐ Use Node.js latest uwu
uses: actions/setup-node@v4
with:
node-version: "latest"
- name: ๐พ๐พ Cache NPM dependencies OwO
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: ๐พ Cache Hexo build files โจ
uses: actions/cache@v4
with:
path: |
.deploy_git
.hexo
key: ${{ runner.os }}-hexo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-hexo-
- name: ๐ฅ๐ฌ Install Dependencies uwuwu
run: npm install
- name: โจ๐ Run ESLint OwO
run: |
npx eslint . || echo "(๏ฝกโขฬ๏ธฟโขฬ๏ฝก) linty errors... but I wonโt stop you senpai~"
- name: ๐๏ธ๐ Build Site nya~
run: npm run build
- name: โ
๐ฎ Add custom Nostr NIP-05 verification UwU
run: |
mkdir -p ./public/.well-known
echo '{
"names": {
"r3bo0tbx1": "1c6234b2c80549b609be27522cbe2b73400859b24a913855d48503d5d819060d"
}
}' > ./public/.well-known/nostr.json
- name: ๐ก๏ธ๐ Ensure .nojekyll and CNAME (so safee~ >w<)
run: |
echo "" > ./public/.nojekyll
echo "brokenbotnet.com" > ./public/CNAME
- name: ๐ธ Upload preview artifact uwu
uses: actions/upload-artifact@v4
with:
name: site-preview
path: ./public
- name: ๐ค๐ Upload Pages artifact OwO
uses: actions/upload-pages-artifact@v3
with:
path: ./public
retention-days: 1
deploy:
name: ๐ Deploy to Pages โจ
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest # ๐งโจ
steps:
- name: ๐๐ธ Deploy to GitHub Pages uwu
id: deployment
uses: actions/deploy-pages@v4
notify:
name: ๐ Send Notifs nya~
needs: build
permissions: {}
runs-on: ubuntu-latest # ๐ง๐
if: always()
steps:
- name: โ
๐ Send Matrix Notification on Success nya~ โจ
if: success()
run: |
curl -X POST -d '{
"msgtype": "m.text",
"body": "๐ธ๐ Yaaay~ Deployment Succeeded! (โฟโ โฟโ ) ๐โจ\n\nYour GitHub Pages site is fresh & shiny now uwu ๐"
}' \
"${{ secrets.MATRIX_SERVER_URL }}/_matrix/client/r0/rooms/${{ secrets.MATRIX_ROOM_ID }}/send/m.room.message?access_token=${{ secrets.MATRIX_ACCESS_TOKEN }}"
- name: โ๐ฟ Send Matrix Notification on Failure (oh noes~) ๐
if: failure()
run: |
curl -X POST -d '{
"msgtype": "m.text",
"body": "โ๐ฅ Oopsies~ Deployment Failed! (๏ฝกโขฬ๏ธฟโขฬ๏ฝก)\n\nโ ๏ธ Please check the GitHub Actions logs for details nya~ ๐ฅบ"
}' \
"${{ secrets.MATRIX_SERVER_URL }}/_matrix/client/r0/rooms/${{ secrets.MATRIX_ROOM_ID }}/send/m.room.message?access_token=${{ secrets.MATRIX_ACCESS_TOKEN }}"