| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- 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
|