Skip to content

build public

build public #37

Workflow file for this run

name: build public
on:
workflow_dispatch:
repository_dispatch:
types:
- public-build
permissions:
contents: write
jobs:
update_submodule:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
token: ${{ secrets.DEPLOY_SECRET }}
- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
- name: Commit update
run: |
git config --global user.name 'Submodule update bot'
git config --global user.email 'bot@noreply.github.com'
git commit -am "content(post): upd" && git push || echo "No changes to commit"
build:
runs-on: ubuntu-latest
needs: update_submodule
steps:
- name: Checkout
uses: actions/checkout@v4
# with:
# submodules: 'recursive'
# token: ${{ secrets.DEPLOY_SECRET }}
# fetch-depth: '0'
- name: Checkout posts
uses: actions/checkout@v4
with:
repository: yy4382/blog-posts
path: src/content/post
token: ${{ secrets.DEPLOY_SECRET }}
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i
- name: Build
run: pnpm build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: main
folder: dist
repository-name: yy4382/blog-public
token: ${{ secrets.DEPLOY_SECRET }}