Build macOS App #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build macOS App | |
on: | |
release: | |
types: [created] | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
- name: Build macOS app | |
run: | | |
pyinstaller project_exporter.spec | |
echo "Contents of dist directory:" | |
ls -R dist | |
- name: Create ZIP archive | |
run: | | |
cd dist | |
zip -r "../项目文件导出工具-macOS.zip" "项目文件导出工具.app" | |
cd .. | |
echo "Contents of current directory:" | |
ls -l | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
if: github.event_name == 'release' && github.event.action == 'created' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./项目文件导出工具-macOS.zip | |
asset_name: 项目文件导出工具-macOS.zip | |
asset_content_type: application/zip | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
if: github.event_name != 'release' | |
with: | |
name: 项目文件导出工具-macOS | |
path: ./项目文件导出工具-macOS.zip | |