mirror of
https://github.com/khrysse/khrysse.github.io.git
synced 2025-06-27 06:31:56 +00:00
58 lines
1.3 KiB
YAML
58 lines
1.3 KiB
YAML
name: Deploy to GitHub Pages
|
||
|
||
on:
|
||
workflow_dispatch:
|
||
push:
|
||
branches:
|
||
- main
|
||
|
||
jobs:
|
||
build_site:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Install Node.js
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: 20
|
||
cache: npm
|
||
|
||
- name: Install dependencies
|
||
run: npm install
|
||
|
||
- name: Build SvelteKit
|
||
env:
|
||
PUBLIC_GITHUB_API_URL: 'https://api.github.com'
|
||
PUBLIC_GITHUB_USERNAME: ${{ github.repository_owner }}
|
||
# ➕ ajoute ici le BASE_PATH si besoin (ex : '/mon-repo')
|
||
BASE_PATH: ''
|
||
run: |
|
||
echo "PUBLIC_GITHUB_API_URL=https://api.github.com" >> .env
|
||
echo "PUBLIC_GITHUB_USERNAME=${{ github.repository_owner }}" >> .env
|
||
echo "BASE_PATH=${BASE_PATH}" >> .env
|
||
npm run build
|
||
|
||
- name: Upload build folder
|
||
uses: actions/upload-pages-artifact@v3
|
||
with:
|
||
path: 'build/'
|
||
|
||
deploy:
|
||
needs: build_site
|
||
runs-on: ubuntu-latest
|
||
|
||
permissions:
|
||
pages: write
|
||
id-token: write
|
||
|
||
environment:
|
||
name: github-pages
|
||
url: ${{ steps.deployment.outputs.page_url }}
|
||
|
||
steps:
|
||
- name: Deploy to GitHub Pages
|
||
id: deployment
|
||
uses: actions/deploy-pages@v4
|