basic2/.github/workflows/deploy-example-site.yml
Hooray Hu 807e3f9402 v4.0
2023-10-29 23:00:06 +08:00

63 lines
1.7 KiB
YAML

name: deploy-example-site
on:
push:
branches: [example]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
# 选择要使用的 node 版本
node-version: 18
# registry-url: https://registry.npmmirror.com/
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install antfu/ni
run: npm i -g @antfu/ni
- name: Install dependencies
run: ni --frozen
# 运行构建脚本
- name: Build
env:
NODE_OPTIONS: --max-old-space-size=8192
run: nr build:example
- name: Pushes to another repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.PUSH_TO_ANOTHER_REPO_SSH_DEPLOY_KEY }}
with:
source-directory: dist-example
destination-github-username: fantastic-admin
destination-repository-name: basic-example
user-email: 304327508@qq.com
target-branch: main