From 654c18fa999b02c803e3d2abb63795c47104f876 Mon Sep 17 00:00:00 2001 From: syui Date: Fri, 13 Jun 2025 22:48:00 +0900 Subject: [PATCH] add github --- .github/workflows/pages-simple.yml | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/pages-simple.yml diff --git a/.github/workflows/pages-simple.yml b/.github/workflows/pages-simple.yml new file mode 100644 index 0000000..5cf060d --- /dev/null +++ b/.github/workflows/pages-simple.yml @@ -0,0 +1,61 @@ +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 }} \ No newline at end of file