Skip to content

尝试继续拆分CI步骤 #586

尝试继续拆分CI步骤

尝试继续拆分CI步骤 #586

name: dev_shawn分支自动打包
on:
push:
branches:
- dev_shawn
workflow_dispatch:
jobs:
build-frontend:
runs-on: ubuntu-22.04
steps:
- name: fetch source
uses: actions/checkout@v4
- name: setup nodejs 16
uses: actions/setup-node@v4
with:
node-version: 16
cache: "npm"
cache-dependency-path: "ui/package-lock.json"
- name: build frontend
working-directory: ui
shell: bash
run: |
npm ci
npm run build
- name: cache frontend dist
uses: actions/cache/save@v3
with:
key: frontend-dist-${{ github.sha }}
path: ui/dist
build-docs:
runs-on: ubuntu-22.04
steps:
- name: fetch source
uses: actions/checkout@v4
with:
ref: doc-pages
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7.8"
bundler-cache: true
- name: build docs
run: bundle exec jekyll build -b /docs
- name: cache docs
uses: actions/cache/save@v3
with:
key: docs-${{ github.sha }}
path: _site
build-mower:
runs-on: windows-2022
steps:
- name: download source
uses: actions/checkout@v4
- name: change version number
if: github.event.head_commit.message != '发版'
shell: bash
run: |
sed -i "s/__version__ = '\(.*\)'/__version__ = '\1+${GITHUB_SHA::7}'/g" ./arknights_mower/__init__.py
- name: install python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Install dependencies
shell: cmd
run: |
python -m venv venv
venv\Scripts\pip install -r requirements.txt
venv\Scripts\pip install -U pyinstaller
- name: install UPX
uses: crazy-max/ghaction-upx@v2
with:
install-only: true
- name: Make package
shell: cmd
run: |
set PYTHONHASHSEED=114514
set SOURCE_DATE_EPOCH=1694076231
venv\Scripts\pyinstaller .\webui_zip.spec --distpath=mower
- name: cache mower
uses: actions/cache/save@v3
with:
key: mower-${{ github.sha }}
path: mower/mower
build-win-amd64:
needs:
- build-frontend
- build-docs
- build-mower
runs-on: ubuntu-22.04
steps:
- name: download updater
uses: actions/checkout@v4
with:
repository: ArkMowers/updater
- name: restore mower
uses: actions/cache/restore@v3
with:
key: mower-${{ github.sha }}
path: mower
- name: restore frontend dist
uses: actions/cache/restore@v3
with:
key: frontend-dist-${{ github.sha }}
path: mower/_internal/dist
- name: restore docs
uses: actions/cache/restore@v3
with:
key: docs-${{ github.sha }}
path: mower/_internal/dist/docs
- name: install python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Install dependencies
run: |
python -m venv venv
venv/bin/pip install -U xxhash backports.zoneinfo[tzdata]
- name: calculate hash
working-directory: mower
run: ../venv/bin/python ../publish.py
- name: create zip
run: zip -r mower.zip mower
- uses: actions/upload-artifact@v3
with:
name: mower
path: mower/mower.zip