name: "Build: Desktop" on: workflow_dispatch: workflow_call: inputs: semver: required: true type: string push: branches: [ "main" ] paths: [ "desktopApp", "frontend" ] pull_request: branches: [ "main" ] paths: [ "desktopApp", "frontend" ] jobs: build-desktop: permissions: write-all runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v3 with: node-version: '16' - name: Install dependencies run: | cd desktopApp npm install - name: Install zip utility run: | apt-get update apt-get install -y zip - name: Build for macOS run: | cd desktopApp npm run package-mac - name: Build for Windows run: | cd desktopApp npm run package-win - name: Build for Linux run: | cd desktopApp npm run package-linux - name: Create ZIP for macOS Build run: | cd desktopApp/release-builds/ zip -r /desktopApp-mac.zip ./Robosats-darwin-x64/* - name: Create ZIP for Windows Build run: | cd desktopApp/release-builds/ zip -r /desktopApp-win.zip ./Robosats-win32-ia32/* - name: Create ZIP for Linux Build run: | cd desktopApp/release-builds/ zip -r /desktopApp-linux.zip ./Robosats-linux-x64/* - name: 'Get Commit Hash' id: commit uses: pr-mpt/actions-commit-hash@v3 - name: 'Upload mac-build Release Artifact (for Release)' uses: actions/upload-artifact@v4 if: inputs.semver != '' # only if this workflow is called from a push to tag (a Release) with: name: robosats-desktop-${{ inputs.semver }}-mac.zip path: desktopApp/release-builds/desktopApp-mac.zip - name: 'Upload linux-build Release Artifact (for Release)' uses: actions/upload-artifact@v4 if: inputs.semver != '' # only if this workflow is called from a push to tag (a Release) with: name: robosats-desktop-${{ inputs.semver }}-linux.zip path: desktopApp/release-builds/desktopApp-linux.zip - name: 'Upload win-build Release Artifact (for Release)' uses: actions/upload-artifact@v4 if: inputs.semver != '' # only if this workflow is called from a push to tag (a Release) with: name: robosats-desktop-${{ inputs.semver }}-win.zip path: desktopApp/release-builds/desktopApp-win.zip - name: Create Pre-release id: create_release if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release) uses: ncipollo/release-action@v1.13.0 with: tag: desktop-${{ steps.commit.outputs.short }} name: robosats-desktop-${{ steps.commit.outputs.short }} prerelease: true - name: Upload macOS Build Artifact id: upload-release-mac-zip-asset if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: /desktopApp-mac.zip asset_name: robosats-desktop-${{ steps.commit.outputs.short }}-mac.zip asset_content_type: application/zip - name: Upload Windows Build Artifact id: upload-release-win-zip-asset if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: /desktopApp-win.zip asset_name: robosats-desktop-${{ steps.commit.outputs.short }}-win.zip asset_content_type: application/zip - name: Upload Linux Build Artifact id: upload-release-linux-zip-asset if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: /desktopApp-linux.zip asset_name: robosats-desktop-${{ steps.commit.outputs.short }}-linux.zip asset_content_type: application/zip