diff --git a/.github/workflows/python-publish-gpu.yml b/.github/workflows/python-publish-gpu.yml deleted file mode 100644 index 1937419..0000000 --- a/.github/workflows/python-publish-gpu.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI - GPU Support - -on: - push: - tags: - - 'v*' - -permissions: - id-token: write - -jobs: - build-n-publish: - if: startsWith(github.ref, 'refs/tags/') - - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - name: Set preferred device to GPU - run: >- - sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --wheel - --outdir dist/ - . - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@v1.8.5 - with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository-url: https://test.pypi.org/legacy/ - skip_existing: true - - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@v1.8.5 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - skip_existing: true diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 041fe38..ad75648 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -49,3 +49,43 @@ jobs: with: password: ${{ secrets.PYPI_API_TOKEN }} skip_existing: true + + build-n-publish-gpu: + if: startsWith(github.ref, 'refs/tags/') + + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Set preferred device to GPU + run: >- + sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --wheel + --outdir dist/ + . + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@v1.8.5 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + skip_existing: true + - name: Publish distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@v1.8.5 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + skip_existing: true diff --git a/.github/workflows/release-gpu.yml b/.github/workflows/release-gpu.yml deleted file mode 100644 index f59862a..0000000 --- a/.github/workflows/release-gpu.yml +++ /dev/null @@ -1,153 +0,0 @@ -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
\nUncategorized\n\n#{{UNCATEGORIZED}}\n
\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: mikepenz/action-gh-release@v0.2.0-a03 - with: - body: ${{steps.github_release.outputs.changelog}} - draft: true - prerelease: true - - - name: Create release url file - run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt - - - name: Save release url file for publish - uses: actions/upload-artifact@v1 - with: - name: release_url - path: release_url.txt - - publish: - needs: [release] - - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: '3.7' - - - name: Set preferred device to GPU - shell: bash -l {0} - run: >- - sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py - - - 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 - if: runner.os == 'macOS' - - - name: Run pyinstaller - shell: bash -l {0} - run: | - pip install pyinstaller - pyinstaller anylabeling.spec - - - name: Load release url file from release job - uses: actions/download-artifact@v1 - with: - name: release_url - - - name: Get release file name & upload url - id: get_release_info - run: | - echo "::set-output name=upload_url::$(cat release_url/release_url.txt)" - - - name: Upload release executable on macOS & Linux - id: upload_release_executable_macos_linux - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release_info.outputs.upload_url }} - asset_path: ./dist/anylabeling - asset_name: AnyLabeling-${{ runner.os }}-GPU - asset_content_type: application/octet-stream - if: runner.os != 'Windows' - - - name: Upload release executable on Windows - id: upload_release_executable_windows - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release_info.outputs.upload_url }} - asset_path: ./dist/anylabeling.exe - asset_name: AnyLabeling-GPU.exe - asset_content_type: application/octet-stream - if: runner.os == 'Windows' - - - name: Create dmg for macOS - run: | - npm install -g create-dmg - cd dist - create-dmg AnyLabeling.app || test -f AnyLabeling\ 0.0.0.dmg - mv AnyLabeling\ 0.0.0.dmg AnyLabeling.dmg - if: runner.os == 'macOS' - - - name: Upload release app on macOS - id: upload_release_app_macos - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release_info.outputs.upload_url }} - asset_path: ./dist/AnyLabeling.dmg - asset_name: AnyLabeling-GPU.dmg - asset_content_type: application/octet-stream - if: runner.os == 'macOS' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb52032..839b87f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -151,3 +151,98 @@ jobs: asset_name: AnyLabeling.dmg asset_content_type: application/octet-stream if: runner.os == 'macOS' + + publish-gpu: + needs: [release] + + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: '3.7' + + - name: Set preferred device to GPU + shell: bash -l {0} + run: >- + sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py + + - 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 + if: runner.os == 'macOS' + + - name: Run pyinstaller + shell: bash -l {0} + run: | + pip install pyinstaller + pyinstaller anylabeling.spec + + - name: Load release url file from release job + uses: actions/download-artifact@v1 + with: + name: release_url + + - name: Get release file name & upload url + id: get_release_info + run: | + echo "::set-output name=upload_url::$(cat release_url/release_url.txt)" + + - name: Upload release executable on macOS & Linux + id: upload_release_executable_macos_linux + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./dist/anylabeling + asset_name: AnyLabeling-${{ runner.os }}-GPU + asset_content_type: application/octet-stream + if: runner.os != 'Windows' + + - name: Upload release executable on Windows + id: upload_release_executable_windows + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./dist/anylabeling.exe + asset_name: AnyLabeling-GPU.exe + asset_content_type: application/octet-stream + if: runner.os == 'Windows' + + - name: Create dmg for macOS + run: | + npm install -g create-dmg + cd dist + create-dmg AnyLabeling.app || test -f AnyLabeling\ 0.0.0.dmg + mv AnyLabeling\ 0.0.0.dmg AnyLabeling.dmg + if: runner.os == 'macOS' + + - name: Upload release app on macOS + id: upload_release_app_macos + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./dist/AnyLabeling.dmg + asset_name: AnyLabeling-GPU.dmg + asset_content_type: application/octet-stream + if: runner.os == 'macOS' diff --git a/anylabeling/app_info.py b/anylabeling/app_info.py index 4bebfe3..8283a36 100644 --- a/anylabeling/app_info.py +++ b/anylabeling/app_info.py @@ -1,4 +1,4 @@ __appname__ = "AnyLabeling" __appdescription__ = "Effortless data labeling with AI support" -__version__ = "0.2.20" +__version__ = "0.2.21" __preferred_device__ = "CPU" # GPU or CPU