Skip to content

Commit

Permalink
CI:自动更新election-static/static目录下的网站文件 (#54)
Browse files Browse the repository at this point in the history
* 更新 page.yml

* 更新 app.yml

不再需要构建页面了

* 更新 page.yml

补一个push条件
  • Loading branch information
luyanci authored Mar 26, 2024
1 parent 65fb97f commit 8386e8b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- main # default branch
paths:
- electron-static/**/**
- Genshin-Impact-Wish-Simulator/src/**/**
- Genshin-Impact-Wish-Simulator/src-tauri/**/**
pull_request:
branches:
Expand All @@ -19,12 +18,8 @@ on:


jobs:
Page:
name: Build Pages
uses: ./.github/workflows/page.yml
Build-app:
name: Build app with Electron
needs: Page
strategy:
fail-fast: false
matrix:
Expand All @@ -47,16 +42,6 @@ jobs:
run: |
cd electron-static
yarn install
- name: Download Artifact
uses: actions/download-artifact@v3
- name: extract new
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
7z x ./frontend -oelectron-static/ -y
- name: extract new(For Windows)
if: runner.os == 'windows'
run: |
7z x .\frontend -oelectron-static/ -y
- name: Build
run: |
cd electron-static
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
- main # default branch
paths:
- Genshin-Impact-Wish-Simulator/src/**/**
push:
branches:
- main # default branch
paths:
- electron-static/**/**
- Genshin-Impact-Wish-Simulator/src-tauri/**/**

jobs:
Build:
Expand Down Expand Up @@ -42,3 +48,33 @@ jobs:
with:
name: frontend
path: Genshin-Impact-Wish-Simulator/frontend.zip
updater:
if: ${{github.event_name == 'workflow_dispatch'}} || ${{github.event_name == 'push'}}
name: Update static files
needs: Build
runs-on: ubuntu-latest
steps:
- name: Set Git config
run: |
git config --global user.name github-actions[bot]
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: frontend
- name: Remove old
run: |
cd electron-static
rm -rf static
- name: Extract new
run: |
7z x ./frontend.zip -oelectron-static/ -y
- name: Create commit
run: |
git add electron-static/static/**/**
git commit -m "Update static files"
- name: Push commit
run: |
git push

0 comments on commit 8386e8b

Please sign in to comment.