legado/.github/workflows/web.yml

66 lines
1.5 KiB
YAML
Raw Normal View History

2023-04-07 21:41:29 +08:00
name: Build Web
on:
push:
branches:
- master
paths:
- '**/modules/web/**'
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
uses: actions/checkout@v4
2023-04-07 21:41:29 +08:00
2023-04-08 20:01:12 +08:00
- name: Install Node.js
uses: actions/setup-node@v4
2023-04-08 20:01:12 +08:00
with:
node-version: 16
- 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
if: ${{ github.event_name != 'pull_request' && github.repository == env.UPSTREAM_REPOSITORY }}
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/