fix gh-actions
This commit is contained in:
62
.github/workflows/deploy.yml
vendored
62
.github/workflows/deploy.yml
vendored
@ -1,62 +0,0 @@
|
||||
name: Deploy ailog
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo build
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Build ailog
|
||||
run: cargo build --release
|
||||
|
||||
- name: Generate static site
|
||||
run: |
|
||||
./target/release/ailog build my-blog
|
||||
touch my-blog/public/.nojekyll
|
||||
|
||||
- name: Setup Cloudflare Pages
|
||||
run: |
|
||||
# Cloudflare Pages用の設定
|
||||
echo '/* /index.html 200' > my-blog/public/_redirects
|
||||
echo 'X-Frame-Options: DENY' > my-blog/public/_headers
|
||||
echo 'X-Content-Type-Options: nosniff' >> my-blog/public/_headers
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
if: github.ref == 'refs/heads/main'
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./my-blog/public
|
||||
publish_branch: gh-pages
|
61
.github/workflows/pages-simple.yml
vendored
61
.github/workflows/pages-simple.yml
vendored
@ -1,61 +0,0 @@
|
||||
name: Deploy Blog to Cloudflare Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
HUGO_VERSION: '0.139.2'
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
cache-dependency-path: oauth/package-lock.json
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: ${{ env.HUGO_VERSION }}
|
||||
extended: true
|
||||
|
||||
- name: Build OAuth components
|
||||
run: |
|
||||
cd oauth
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Integrate OAuth with Hugo
|
||||
run: |
|
||||
# Create oauth directory in static
|
||||
mkdir -p my-blog/static/oauth
|
||||
|
||||
# Copy built assets
|
||||
cp -r oauth/dist/assets/* my-blog/static/assets/ 2>/dev/null || true
|
||||
cp oauth/dist/index.html my-blog/static/oauth/ 2>/dev/null || true
|
||||
cp oauth/dist/client-metadata.json my-blog/static/ 2>/dev/null || true
|
||||
|
||||
- name: Build Hugo site
|
||||
run: |
|
||||
cd my-blog
|
||||
TZ=Asia/Tokyo hugo --minify
|
||||
|
||||
- name: Deploy to Cloudflare Pages
|
||||
uses: cloudflare/pages-action@v1
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
projectName: ai-log # または ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
|
||||
directory: my-blog/public
|
||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
Reference in New Issue
Block a user