πΈβ¨ Hexo to gh-pages UwU β¨πΈ #300
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Hexo to gh-pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.FINE_GRAINED_PAT }} | |
| submodules: recursive | |
| - name: Check for Theme Updates | |
| 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 | |
| git commit -am "Update theme to the latest version π¨β¨" | |
| 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 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "latest" | |
| - name: Cache NPM dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.OS }}-npm-cache | |
| restore-keys: | | |
| ${{ runner.OS }}-npm-cache | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Build | |
| run: npm run build | |
| - name: Add custom Nostr NIP-05 verification β to nostr.json | |
| run: | | |
| mkdir -p ./public/.well-known | |
| echo '{ | |
| "names": { | |
| "r3bo0tbx1": "1c6234b2c80549b609be27522cbe2b73400859b24a913855d48503d5d819060d" | |
| } | |
| }' > ./public/.well-known/nostr.json | |
| - name: Ensure .nojekyll and CNAME | |
| run: | | |
| echo "" > ./public/.nojekyll | |
| echo "brokenbotnet.com" > ./public/CNAME | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./public | |
| retention-days: 1 | |
| deploy: | |
| 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 | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| notify: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Send Matrix Notification on Success | |
| if: success() | |
| run: | | |
| curl -X POST -d '{ | |
| "msgtype": "m.text", | |
| "body": "π Deployment Succeeded! Your GitHub Pages site has been updated successfully." | |
| }' \ | |
| "${{ 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 | |
| if: failure() | |
| run: | | |
| curl -X POST -d '{ | |
| "msgtype": "m.text", | |
| "body": "β Deployment Failed! Please check the GitHub Actions logs for details." | |
| }' \ | |
| "${{ secrets.MATRIX_SERVER_URL }}/_matrix/client/r0/rooms/${{ secrets.MATRIX_ROOM_ID }}/send/m.room.message?access_token=${{ secrets.MATRIX_ACCESS_TOKEN }}" |