Build on every PR (#26) #118
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
--- | |
name: Build artifacts | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create configuration files | |
run: | | |
echo $NPMRC > .npmrc | |
echo $ENV_LOCAL > packages/viewer/.env.local | |
env: | |
NPMRC: | | |
node-linker=hoisted | |
ENV_LOCAL: ${{ vars.ENV_LOCAL }} | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
- name: Use Node.js LTS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Next.js build cache | |
uses: actions/cache@v3 | |
with: | |
path: packages/viewer/.next/cache/ | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('packages/viewer/**/*.[jt]s', 'packages/viewer/**/*.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}- | |
${{ runner.os }}-nextjs- | |
- name: Build | |
run: pnpm -r run build | |
# - name: Upload luogu-discussion-archive | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: luogu-discussion-archive | |
# path: packages/archive/dist/ | |
# - name: Upload luogu-discussion-viewer | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: luogu-discussion-viewer | |
# path: | | |
# packages/viewer/.next/ | |
# !packages/viewer/.next/cache/ |