mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
modules 添加web
This commit is contained in:
66
modules/web/.github/workflows/build.yml
vendored
Normal file
66
modules/web/.github/workflows/build.yml
vendored
Normal 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
|
||||
40
modules/web/.github/workflows/release.yml
vendored
Normal file
40
modules/web/.github/workflows/release.yml
vendored
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user