2023-04-07 21:41:29 +08:00
|
|
|
name: Build Web
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
|
|
|
- '**/modules/web/**'
|
2023-04-16 08:59:15 +08:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- '**/modules/web/**'
|
2023-04-07 21:41:29 +08:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
|
|
|
UPSTREAM_REPOSITORY: gedoor/legado
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-04-08 20:01:12 +08:00
|
|
|
- name: Checkout
|
2023-09-18 20:51:37 +08:00
|
|
|
uses: actions/checkout@v4
|
2023-04-07 21:41:29 +08:00
|
|
|
|
2023-04-08 20:01:12 +08:00
|
|
|
- name: Install Node.js
|
2023-10-30 12:13:56 +08:00
|
|
|
uses: actions/setup-node@v4
|
2023-04-08 20:01:12 +08:00
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
|
2024-02-12 12:11:06 +08:00
|
|
|
- uses: pnpm/action-setup@v3
|
2023-04-08 20:01:12 +08:00
|
|
|
name: Install pnpm
|
|
|
|
id: pnpm-install
|
|
|
|
with:
|
|
|
|
version: 8
|
|
|
|
run_install: false
|
|
|
|
|
|
|
|
- name: Get pnpm store directory
|
|
|
|
id: pnpm-cache
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
|
|
|
2024-02-02 07:57:54 +08:00
|
|
|
- uses: actions/cache@v4
|
2023-04-08 20:01:12 +08:00
|
|
|
name: Setup pnpm cache
|
2023-04-07 21:41:29 +08:00
|
|
|
with:
|
2023-04-08 20:01:12 +08:00
|
|
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
|
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/web/package.json') }}
|
2023-04-07 21:41:29 +08:00
|
|
|
restore-keys: |
|
2023-04-08 20:01:12 +08:00
|
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
|
|
|
|
- name: Build and move files
|
2023-05-16 16:51:19 +08:00
|
|
|
working-directory: modules/web
|
2023-04-07 21:41:29 +08:00
|
|
|
run: |
|
2023-04-08 20:05:45 +08:00
|
|
|
pnpm i
|
2023-04-08 20:01:12 +08:00
|
|
|
pnpm build
|
2023-04-07 21:41:29 +08:00
|
|
|
version="v$(date -d "8 hour" -u +3.%y.%m%d%H)"
|
|
|
|
echo "APP_VER=$version" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: push changes
|
2023-04-16 08:59:15 +08:00
|
|
|
if: ${{ github.event_name != 'pull_request' && github.repository == env.UPSTREAM_REPOSITORY }}
|
2024-04-15 12:24:59 +08:00
|
|
|
uses: stefanzweifel/git-auto-commit-action@v5.0.1
|
2023-04-07 21:41:29 +08:00
|
|
|
with:
|
2023-04-08 08:52:19 +08:00
|
|
|
commit_message: Bump web ${{ env.APP_VER}}
|
2023-04-07 21:41:29 +08:00
|
|
|
file_pattern: app/src/main/assets/web/vue/
|
|
|
|
|