Skip to content

CI修复py38路径问题 #591

CI修复py38路径问题

CI修复py38路径问题 #591

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: ubuntu-22.04
steps:
- name: download source
uses: actions/checkout@v4
- name: change version number
if: github.event.head_commit.message != '发版'
run: sed -i "s/__version__ = '\(.*\)'/__version__ = '\1+${GITHUB_SHA::7}'/g" ./arknights_mower/__init__.py
- name: install wine
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install wine
- name: install python 3.8
run: |
mkdir py38
cd py38
wget https://www.python.org/ftp/python/3.8.10/python-3.8.10-embed-amd64.zip
unzip python-3.8.10-embed-amd64.zip
wget https://bootstrap.pypa.io/get-pip.py
wine python.exe get-pip.py
- name: Install dependencies
run: |
wine py38/Scripts/pip.exe install -r requirements.txt
wine py38/Scripts/pip.exe install -U pyinstaller
- name: install UPX
working-directory: ~/.wine/drive_c
run: |
wget https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-win64.zip
unzip upx-4.2.1-win64.zip
mv upx-4.2.1-win64 upx
- name: make package
env:
PYTHONHASHSEED: 114514
SOURCE_DATE_EPOCH: 1694076231
run: |
wine py38/Scripts/pyinstaller ./webui_zip.spec --upx-dir C:\\upx --distpath=mower
- name: cache mower
uses: actions/cache/save@v3
with:
key: mower-${{ github.sha }}
path: mower/mower
package-and-upload:
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: 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: restore frontend dist
uses: actions/cache/restore@v3
with:
key: frontend-dist-${{ github.sha }}
path: ui/dist
- name: restore docs
uses: actions/cache/restore@v3
with:
key: docs-${{ github.sha }}
path: _site
- name: restore mower
uses: actions/cache/restore@v3
with:
key: mower-${{ github.sha }}
path: mower/mower
- name: merge files
run: |
mv ui/dist mower/mower/_internal/
mv _site mower/mower/_internal/dist/docs
- name: calculate hash
working-directory: mower
run: ../venv/bin/python ../publish.py
- name: create zip
working-directory: mower
run: zip -r mower.zip mower
- uses: actions/upload-artifact@v3
with:
name: mower
path: mower/mower.zip