Skip to content

Commit

Permalink
ci: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryolitia committed Apr 6, 2024
1 parent aeab8ec commit 0a7764f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.github @Cryolitia
21 changes: 4 additions & 17 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Build and publish
name: Build releases

on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
paths:
- ".github/**"
- ".github/workflows/build.yaml"
- ".vitepress/**"
- "src/**"
- "theme/**"
Expand All @@ -33,12 +34,6 @@ jobs:
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: current
cache: pnpm

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
Expand Down Expand Up @@ -103,16 +98,8 @@ jobs:
sed -e "s/BUILD_TIME/$(TZ=Asia/Shanghai date -Isecond)/" -e "s/COMMIT_SHA/${{ github.sha }}/" -i src/about.md
pnpm run build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }}
projectName: proskynova-github-io
directory: .vitepress/dist/
wranglerVersion: 3

- name: Release eBook
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ github.token }}
run: pnpm exec semantic-release
57 changes: 57 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish to Cloudflare

on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
paths:
- ".github/workflows/publish.yaml"
- ".vitepress/**"
- "src/**"
- "theme/**"
- "package-lock.json"
- "package.json"

permissions:
contents: write
issues: write
pull-requests: write

concurrency:
group: "publish"
cancel-in-progress: true

jobs:
build:
name: Build and publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true

- name: Build
env:
NODE_OPTIONS: --max_old_space_size=4096
run: |
sed -e "s/BUILD_TIME/$(TZ=Asia/Shanghai date -Isecond)/" -e "s/COMMIT_SHA/${{ github.sha }}/" -i src/about.md
pnpm run web:build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }}
projectName: transky-book
directory: .vitepress/dist/
wranglerVersion: 3

0 comments on commit 0a7764f

Please sign in to comment.