Skip to content

Commit

Permalink
[non-related] ci: test6
Browse files Browse the repository at this point in the history
Signed-off-by: crrashh1542 <kotsuki@crrashh.com>
  • Loading branch information
crrashh1542 committed Jun 27, 2024
1 parent 36d3eb3 commit 13ef89e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Build Production Pages
on:
pull_request:
workflow_call:
inputs:
distname:
type: string
required: false
pull_request

jobs:
setup:
Expand All @@ -24,19 +19,14 @@ jobs:
- name: 📙 Get Build Information
id: get-info
run: |
# 如果是 Pull Request 请求的 build,则从头获取项目信息并生成 dist 名
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
COMMIT_COUNT=$(git rev-list --count HEAD)
BUILD_DATE=$(date "+%y%m%d")
HEAD_SHA=$(git rev-parse --short HEAD)
echo "DIST_NAME=dist-PR-${COMMIT_COUNT}-${BUILD_DATE}-${HEAD_SHA}" >> $GITHUB_OUTPUT
# 如果是 Pull Request 请求的 build,则从头获取项目信息并生成 dist 名
else
echo "DIST_NAME=${INPUTS_DISTNAME}" >> $GITHUB_OUTPUT
build:
name: Deploy to Github Pages
name: Build Production Pages
runs-on: ubuntu-latest
needs: setup
env:
Expand Down
39 changes: 24 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,46 @@ jobs:
echo "DIST_NAME=dist-${COMMIT_COUNT}-${BUILD_DATE}-${HEAD_SHA}" >> $GITHUB_OUTPUT
main:
name: Deploy to Github Pages
name: Build Production Pages
runs-on: ubuntu-latest
needs: setup
env:
DIST_NAME: ${{ needs.setup.outputs.DIST_NAME }}
runs-on: ubuntu-latest
steps:
- name: 🧐 Checkout
if: github.event_name == 'pull_request'
id: checkout
uses: actions/checkout@v4

- name: 🔧 Setup pnpm
id: setup_pnpm
uses: pnpm/action-setup@v4
with:
fetch-depth: '0'

- name: 🔨 Build Production Pages
version: latest

- name: 🚧 Setup dependencies
id: setup_deps
run: |
pnpm install
- name: 📦 Build production pages
id: build
uses: ./../.github/workflows/build.yml
with:
distname: ${{ env.DIST_NAME }}

- name: 📦 Download from Artifacts
id: download
uses: actions/download-artifact@v4
run: |
mv docs/.vitepress/config.ts docs/.vitepress/config.ts.bak
mv docs/.vitepress/config.pages.ts docs/.vitepress/config.ts
pnpm run build
cp docs/assets/logo.png dist/assets/
- name: 🌐 Upload the build
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.DIST_NAME }}
path: dist


- name: 🚀 Deploy to Github Pages
id: deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
branch: gh-pages
token: ${{ secrets.DEPLOY_TOKEN }}
token: ${{ secrets.DEPLOY_TOKEN }}

0 comments on commit 13ef89e

Please sign in to comment.