Skip to content

Commit

Permalink
feat: add wrangler and @askcodebase/next-on-pages deps
Browse files Browse the repository at this point in the history
  • Loading branch information
shiqimei committed Aug 21, 2023
1 parent b164f82 commit 6847c19
Show file tree
Hide file tree
Showing 3 changed files with 2,218 additions and 71 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Publish to Cloudflare

on:
push:
branches:
- main

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: '16.17'

- name: Install pnpm & jq
run: |
npm install -g pnpm
sudo apt-get install jq
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install

- name: Build project
run: pnpm cf:build

- name: Deploy to Production Environment
run: pnpm cf:github:publish -- --branch=${{ github.ref }} --commit-hash=${{ github.sha }} --commit-message="${{ github.event.head_commit.message }}"
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"name": "nextra-docs-template",
"name": "askcodebase-docs",
"version": "0.0.1",
"description": "Nextra docs template",
"description": "AskCodebase Docs",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
"start": "next start",
"cf:build": "npx @askcodebase/next-on-pages",
"cf:github:publish": "CLOUDFLARE_ACCOUNT_ID=$CLOUDFLARE_ACCOUNT_ID CLOUDFLARE_API_TOKEN=$CLOUDFLARE_API_TOKEN && wrangler pages deploy --project-name askcodebase-docs .vercel/output/static"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shuding/nextra-docs-template.git"
},
"author": "Shu Ding <[email protected]>",
"author": "AskCodebase <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/shuding/nextra-docs-template/issues"
Expand All @@ -26,10 +28,12 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@askcodebase/next-on-pages": "^0.1.0",
"@types/node": "18.11.10",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"typescript": "^4.9.3"
"typescript": "^4.9.3",
"wrangler": "^3.5.1"
}
}
Loading

0 comments on commit 6847c19

Please sign in to comment.