Merge branch 'releases/v0.5.9' of github.com:datature/portal into rel… #52
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: Portal CI/CD | |
on: | |
push: | |
branches: [releases/v*] | |
jobs: | |
build-electron: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# os: [ubuntu-latest, windows-latest, macos-latest] | |
os: [macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set the env variables | |
run: | | |
echo "USE_HARD_LINKS=false" >> $GITHUB_ENV | |
- name: Extract Platform | |
shell: bash | |
run: | | |
OS=${{ matrix.os }} | |
echo "##[set-output name=platform;]$(echo ${OS%-latest})" | |
id: extract_platform | |
- name: Extract Version | |
shell: bash | |
run: echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/heads/releases/v})" | |
id: extract_version | |
- name: Extract Executable name | |
shell: bash | |
run: | | |
if [ ${{ steps.extract_platform.outputs.platform }} = "windows" ]; then | |
echo "##[set-output name=name;]$(echo Portal Setup ${{ steps.extract_version.outputs.version }}.exe)" | |
elif [ ${{ steps.extract_platform.outputs.platform }} = "ubuntu" ]; then | |
echo "##[set-output name=name;]$(echo Portal-${{ steps.extract_version.outputs.version }}.AppImage)" | |
else | |
echo "##[set-output name=name;]$(echo Portal-${{ steps.extract_version.outputs.version }}.dmg)" | |
fi | |
id: extract_executable_name | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install Engine dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pylint | |
pip install -r ./requirements.txt | |
python -m pip install --upgrade pyinstaller | |
- name: Package Application with pyinstaller | |
working-directory: ./src/engine | |
shell: bash | |
run: | | |
pyinstaller --collect-data ultralytics --hidden-import pydicom.encoders.gdcm --hidden-import pydicom.encoders.pylibjpeg --hidden-import engineio.async_drivers.threading -F run.py --distpath ../../portal_build/dist | |
if [ -f ../../portal_build/dist/run ]; then | |
chmod u+x ../../portal_build/dist/run | |
else | |
chmod u+x ../../portal_build/dist/run.exe | |
fi | |
# Install Node.js | |
- uses: actions/[email protected] | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
scope: "@datature" | |
# Install your dependencies | |
- name: Installing Portal dependencies | |
working-directory: . | |
run: npm install --legacy-peer-deps | |
- name: Publish | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: . | |
run: | | |
npm run dist | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ steps.extract_platform.outputs.platform }}-electron | |
path: ./application/ ${{ steps.extract_executable_name.name }} | |
retention-days: 1 | |
release: | |
needs: [build-electron] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Extract Version | |
shell: bash | |
run: echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/heads/releases/v})" | |
id: extract_version | |
- name: release | |
uses: actions/create-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: true | |
prerelease: false | |
tag_name: v${{ steps.extract_version.outputs.version }} | |
release_name: ${{ steps.extract_branch.outputs.branch }} | |
- uses: actions/download-artifact@v2 | |
with: | |
name: windows-electron | |
path: ./application/windows | |
# - uses: actions/download-artifact@v2 | |
# with: | |
# name: ubuntu-electron | |
# path: ./application/linux | |
- uses: actions/download-artifact@v2 | |
with: | |
name: macos-electron | |
path: ./application/mac | |
- name: Upload windows to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./application/windows/Portal Setup ${{ steps.extract_version.outputs.version }}.exe | |
asset_name: Portal-${{ steps.extract_version.outputs.version }}-windows.exe | |
asset_content_type: application/exe | |
# - name: Upload linux to release | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: ./application/linux/Portal-${{ steps.extract_version.outputs.version }}.AppImage | |
# asset_name: Portal-${{ steps.extract_version.outputs.version }}-linux.AppImage | |
# asset_content_type: application/AppImage | |
- name: Upload mac to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./application/mac/Portal-${{ steps.extract_version.outputs.version }}.dmg | |
asset_name: Portal-${{ steps.extract_version.outputs.version }}-macos.dmg | |
asset_content_type: application/dmg |