modules 添加web

This commit is contained in:
Xwite
2023-04-07 20:27:20 +08:00
parent 3447e46176
commit 57e2c3a418
88 changed files with 5784 additions and 0 deletions

66
modules/web/.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,66 @@
name: Build
on:
push:
branches:
- main
workflow_dispatch:
env:
UPSTREAM_REPOSITORY: gedoor/legado_web_source_editor
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Project
run: |
npm install
- name: Format code
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
run: |
npm run-script lint
- name: push changes
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
uses: stefanzweifel/git-auto-commit-action@v4.16.0
with:
commit_message: 'style: format code'
file_pattern: src
- name: Build
run: |
npm run-script build
- name: Set Env
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
shell: bash
run: |
version="v$(date -d "8 hour" -u +3.%y.%m%d%H)"
echo "APP_VER=$version" >> $GITHUB_ENV
- name: Push changes to legado
continue-on-error: true
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git clone "https://gedoor:${{ secrets.ACTIONS_TOKEN }}@github.com/gedoor/legado" --depth 1
rm -rf legado/app/src/main/assets/web/source/*
mv -f $GITHUB_WORKSPACE/dist/* legado/app/src/main/assets/web/source/
cd legado
git add -A
git commit -m "web source editor: ${{ env.APP_VER }}"
git push

View File

@@ -0,0 +1,40 @@
name: Release
on: [workflow_dispatch]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set Env
shell: bash
run: |
version="v$(date -d "8 hour" -u +3.%y.%m%d%H)"
echo "VERSION=$version" >> $GITHUB_ENV
- name: Build
run: |
npm install
npm run-script build
zip -q -r ${{github.ref_name}}_${{env.VERSION}}.zip ./dist
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
draft: false
prerelease: false
files: ${{ github.workspace }}/*.zip