From 466904c1b7c654bc4ae309d17333a61b9c30e590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E9=9B=81=20Cryolitia?= Date: Tue, 19 Mar 2024 12:04:34 +0800 Subject: [PATCH] Create publish.yaml --- .github/workflows/publish.yaml | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..b253daa3 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,53 @@ +name: Build and deploy + +on: + push: + branches: + - 'main' + paths: + - ".github/**" + - ".vitepress/**" + - "src/**" + - "theme/**" + - "book.toml" + - "package-lock.json" + - "package.json" + +permissions: + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + name: Build and deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: pnpm/action-setup@v3 + with: + version: latest + - uses: actions/setup-node@v4 + with: + cache: pnpm + - name: Install + run: pnpm install + - name: Build + run: | + sed -e "s/BUILD_TIME/$(TZ=Asia/Shanghai date -Isecond)/" -e "s/COMMIT_SHA/${{ github.sha }}/" -i src/about.md + pnpm build + env: + NODE_OPTIONS: --max_old_space_size=4096 + - 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'