Skip to content

Refactor binary build #53

Refactor binary build

Refactor binary build #53

Workflow file for this run

name: New Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configurationJson: |
{
"template": "## What's Changed\n\n<details>\n<summary>Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>\n\nIf you find this project useful, please consider [sponsoring](https://ko-fi.com/vietanhdev) its development.",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix"]
},
{
"title": "## 💬 Other",
"labels": ["other"]
}
]
}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
body: ${{steps.github_release.outputs.changelog}}
draft: true
prerelease: true
tag_name: ${{ github.ref_name }}
make_latest: 'false'
fail_on_unmatched_files: false
build:
needs: [release]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
device: [CPU, GPU]
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10.14"
miniconda-version: "latest"
- name: Set preferred device
shell: bash -l {0}
run: >-
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "${{ matrix.device }}"/g' anylabeling/app_info.py
- name: Install main
shell: bash -l {0}
run: |
pip install .
- name: Run pyinstaller
shell: bash -l {0}
run: |
pip install pyinstaller
pyinstaller anylabeling.spec
- name: Upload Linux/Windows Release Assets
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
files: |
./dist/anylabeling
./dist/anylabeling.exe
fail_on_unmatched_files: false
append_body: true
preserve_order: true
if: success()
build_macos_folder:
needs: [release]
runs-on: macos-latest
permissions:
contents: write
strategy:
matrix:
device: [CPU, GPU]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10.14"
miniconda-version: "latest"
- name: Install main
shell: bash -l {0}
run: |
pip install .
- name: Install PyQt5 for macOS
shell: bash -l {0}
run: |
conda install -c conda-forge pyqt==5.15.7
- name: Make build script executable
shell: bash -l {0}
run: |
chmod +x scripts/build_macos_folder.sh
- name: Build in folder mode
shell: bash -l {0}
run: |
./scripts/build_macos_folder.sh ${{ matrix.device }}
- name: Create zip archive
shell: bash -l {0}
run: |
cd dist && zip -r AnyLabeling-Folder${{ matrix.device == 'GPU' && '-GPU' || '' }}.zip AnyLabeling-Folder${{ matrix.device == 'GPU' && '-GPU' || '' }}/
- name: Upload macOS Folder Build Assets
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
files: ./dist/AnyLabeling-Folder${{ matrix.device == 'GPU' && '-GPU' || '' }}.zip
append_body: true
preserve_order: true
if: success()