Skip to content

๐ŸŒธโœจ Hexo to gh-pages UwU โœจ๐ŸŒธ #553

๐ŸŒธโœจ Hexo to gh-pages UwU โœจ๐ŸŒธ

๐ŸŒธโœจ Hexo to gh-pages UwU โœจ๐ŸŒธ #553

Workflow file for this run

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 }}"