Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy MathNote to GitHub Pages

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 24
package-manager-cache: false

- name: Install dependencies
run: npm install --no-audit --no-fund

- name: Build offline distribution
run: npm run build

- name: Verify offline distribution
run: node scripts/verify-offline.mjs

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./dist

deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ Bu kontrol, build çıktısında uzak script/style/module bağlantısı kalmadı

---

## GitHub Pages

Repo, GitHub Pages üzerinde kaynak `index.html` dosyasını doğrudan yayınlamak yerine GitHub Actions ile build edilir. `.github/workflows/pages.yml` workflow'u:

1. npm bağımlılıklarını kurar.
2. `npm run build` ile `dist/` çıktısını üretir.
3. Offline doğrulamasını çalıştırır.
4. `dist/` klasörünü GitHub Pages artifact'i olarak yükler.
5. `main` branch'ine yapılan push/merge sonrasında artifact'i yayınlar.

GitHub üzerinde bir kez **Settings → Pages → Build and deployment → Source → GitHub Actions** seçilmelidir. Bundan sonra her `main` güncellemesi otomatik olarak `https://alorak.github.io/mathnote/` adresine deploy edilir.

PR'larda workflow yalnızca build ve doğrulama yapar; canlı deploy yalnızca `main` üzerinde gerçekleşir.

---

## Lisans

MIT Lisansı
1 change: 1 addition & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ if (html.includes('MATHNOTE_BUILD_')) {
}

await writeFile(new URL('../dist/index.html', import.meta.url), html, 'utf8');
await writeFile(new URL('../dist/.nojekyll', import.meta.url), '', 'utf8');
console.log('MathNote offline bundle written to dist/.');
Loading