Skip to content

Commit

Permalink
更新workflow版本
Browse files Browse the repository at this point in the history
  • Loading branch information
hguandl committed Dec 24, 2024
1 parent 9d4c336 commit 8cf77bf
Showing 1 changed file with 57 additions and 15 deletions.
72 changes: 57 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Bundle with Pyinstaller
on: push
on:
push:
branches: '*'
tags: 'v*'

jobs:
frontend:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -19,9 +22,9 @@ jobs:
echo "tag=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
fi
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18

- name: Build Frontend
working-directory: frontend
Expand All @@ -30,7 +33,7 @@ jobs:
npm run build
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: frontend
path: frontend/dist
Expand All @@ -42,47 +45,86 @@ jobs:
os: [macos, ubuntu, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Download Frontend
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: frontend
path: frontend/dist

- name: Install Dependencies
run: pip3 install -r requirements.txt
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Bundle blivechat (Unix)
if: matrix.os != 'windows'
- name: Install Dependencies (Host Native)
if: matrix.os != 'macos'
run: |
python3 -m venv venv
${{ matrix.os == 'windows' && 'venv\\Scripts\\activate' || 'source venv/bin/activate' }}
pip3 install -r requirements.txt
pip3 install pyinstaller
- name: Install Dependencies (macOS Universal)
if: matrix.os == 'macos'
run: |
python3 -m venv venv
source venv/bin/activate
pip3 download --no-cache-dir --only-binary=:all: \
--platform=macosx_10_13_universal2 \
-d downloads \
-r requirements.txt \
pyinstaller
pip3 install --upgrade --no-cache-dir --no-index --only-binary=:all: \
--find-links downloads \
-r requirements.txt \
pyinstaller
- name: Bundle blivechat (Linux)
if: matrix.os == 'ubuntu'
run: |
source venv/bin/activate
pyinstaller --noconfirm \
--add-data="data:data" \
--add-data="log:log" \
--add-data="frontend/dist:frontend/dist" \
--name blivechat \
--contents-directory . \
main.py
- name: Bundle blivechat (macOS Universal)
if: matrix.os == 'macos'
run: |
source venv/bin/activate
pyinstaller --noconfirm \
--add-data="data:data" \
--add-data="log:log" \
--add-data="frontend/dist:frontend/dist" \
--name blivechat \
--contents-directory . \
--target-arch universal2 \
main.py
- name: Bundle blivechat (Windows)
if: matrix.os == 'windows'
run: |
pip3 install pyinstaller
venv\\Scripts\\activate
pyinstaller --noconfirm `
--add-data="data;data" `
--add-data="log;log" `
--add-data="frontend\dist;frontend\dist" `
--name blivechat `
--contents-directory . `
main.py
- name: Package Bundle
working-directory: dist
run: 7z a -tzip blivechat-${{ needs.frontend.outputs.tag }}-${{ matrix.os }}-x64.zip blivechat

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: blivechat-${{ matrix.os }}-x64
path: dist/blivechat-*.zip
Expand All @@ -95,9 +137,9 @@ jobs:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: ./**/blivechat-*.zip

0 comments on commit 8cf77bf

Please sign in to comment.