Merge remote-tracking branch 'origin/master' #18
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: Deploy Docusaurus to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Docusaurus site | |
| run: npm run build | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./build | |
| publish_branch: main | |
| - name: ✅ Notify Discord on success | |
| if: success() | |
| run: | | |
| COMMIT_TITLE=$(git log -1 --pretty=%s) | |
| COMMIT_BODY=$(git log -1 --pretty=%b) | |
| curl -X POST "$DISCORD_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$(jq -n \ | |
| --arg title "✅ Docusaurus Deploy Succeeded" \ | |
| --arg url "https://hollowhorizon.github.io/HollowEngineDocumentation/" \ | |
| --arg commit "${{ github.sha }}" \ | |
| --arg commitTitle "$COMMIT_TITLE" \ | |
| --arg commitBody "$COMMIT_BODY" \ | |
| --arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ | |
| '{ | |
| embeds: [ | |
| { | |
| title: $title, | |
| description: "[Открыть документацию](\($url))\n\n**Commit:** `\($commit)`\n**Message:** \($commitTitle)\n\($commitBody)", | |
| color: 5763719, | |
| timestamp: $date | |
| } | |
| ] | |
| }')" | |
| - name: ❌ Notify Discord on failure | |
| if: failure() | |
| run: | | |
| COMMIT_TITLE=$(git log -1 --pretty=%s) | |
| COMMIT_BODY=$(git log -1 --pretty=%b) | |
| curl -X POST "$DISCORD_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$(jq -n \ | |
| --arg title "❌ Docusaurus Deploy Failed" \ | |
| --arg url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ | |
| --arg commit "${{ github.sha }}" \ | |
| --arg commitTitle "$COMMIT_TITLE" \ | |
| --arg commitBody "$COMMIT_BODY" \ | |
| --arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ | |
| '{ | |
| embeds: [ | |
| { | |
| title: $title, | |
| description: "**Commit:** `\($commit)`\n**Message:** \($commitTitle)\n\($commitBody)\n\n[View Logs](\($url))", | |
| color: 15548997, | |
| timestamp: $date | |
| } | |
| ] | |
| }')" | |