feat: 支持又拍云 #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Deploy client | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Install dependencies | |
run: | | |
cd ./packages/client | |
pnpm install --frozen-lockfile | |
- name: Build client | |
env: | |
QINIU_ACCESS_KEY: ${{secrets.QINIU_ACCESS_KEY}} | |
QINIU_BUCKET: ${{secrets.QINIU_BUCKET}} | |
QINIU_SECRET_KEY: ${{secrets.QINIU_SECRET_KEY}} | |
QINIU_DOMAIN: ${{vars.QINIU_DOMAIN}} | |
QINIU_PREFIX: ${{vars.QINIU_PREFIX}} | |
QINIU_SCOPE: ${{vars.QINIU_SCOPE}} | |
QINIU_EXPIRES: ${{vars.QINIU_EXPIRES}} | |
run: | | |
echo ${{ github.workspace }} | |
cd ./packages/client | |
pnpm build:github | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: ./packages/client/dist | |
destination: ./_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
# - name: Deploy to GitHub Pages | |
# uses: peaceiris/actions-gh-pages@v3 | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# publish_dir: ./packages/client/dist # 文档打包产物的目录名就是build | |
# user_name: 'github-actions[bot]' | |
# user_email: 'github-actions[bot]@users.noreply.github.com' | |
# commit_message: ${{ github.event.head_commit.message }}` | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |