53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
name: Deploy to Cloudflare Pages
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Build ailog
|
|
run: |
|
|
cargo build --release
|
|
|
|
- name: Build OAuth app
|
|
run: |
|
|
cd oauth
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Copy OAuth assets
|
|
run: |
|
|
cp -r oauth/dist/* my-blog/static/
|
|
|
|
- name: Generate site with ailog
|
|
run: |
|
|
./target/release/ailog generate --input content --output my-blog/public
|
|
|
|
- name: Deploy to Cloudflare Pages
|
|
uses: cloudflare/pages-action@v1
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
projectName: syui-ai
|
|
directory: my-blog/public
|
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }} |