Skip to content

workspace: fix ci

workspace: fix ci #4

name: frontend-legacy
on:
push:
branches:
- master
paths:
- package.json
- yarn.lock
- apps/frontend-legacy/**
- .github/workflows/frontend-legacy.yml
pull_request:
branches:
- master
paths:
- package.json
- yarn.lock
- apps/frontend-legacy/**
- .github/workflows/frontend-legacy.yml
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/cache@v6
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Enable Corepack
run: corepack enable
- name: Use Node.js 22
uses: actions/setup-node@v7
with:
node-version: 22
cache: yarn
- name: Install Dependencies
run: yarn install
- name: Build Site
run: yarn workspace frontend-legacy build
env:
VITE_BAOSHUO_CDNJS: true
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: frontend-legacy-dist
path: apps/frontend-legacy/dist/
retention-days: 1
deploy:
name: Deploy
needs: build
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository == 'OIerDb-ng/OIerDb'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Download Artifact
uses: actions/download-artifact@v8
with:
name: frontend-legacy-dist
path: dist
- name: Deploy site to server (Tokyo, JP)
uses: easingthemes/ssh-deploy@v2.1.5
env:
ARGS: '-avz --delete'
SOURCE: dist/
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
TARGET: ${{ secrets.REMOTE_PATH }}
EXCLUDE: .git,.github,.gitlab-ci.yml,.nojekyll