name: "deploy" on: push: branches: - main jobs: changes: runs-on: ubuntu-latest outputs: desktop: ${{steps.desktop.outputs.src}} preview_folder: ${{steps.preview.outputs.folder}} steps: - uses: actions/checkout@v3 - uses: dorny/paths-filter@v2 id: desktop with: filters: | src: - 'modules/desktop/**' - 'modules/ui/**' - name: get s3 preview folder id: preview run: echo "folder=${{ github.event.number }}-merge" >> $GITHUB_OUTPUT build_desktop: needs: changes if: needs.changes.outputs.desktop == 'true' runs-on: ${{ matrix.platform.os }} strategy: matrix: platform: - os: macos-11 name: darwin+x86-64 # TODO: #181 build for linux # - os: ubuntu-latest # name: linux+x86-64 - os: [self-hosted, macOS, ARM64] name: darwin+aarch64 # err: Package atk was not found in the pkg-config search path. # requires atk >= 2.18 # - os: [self-hosted, linux, ARM64] # name: linux+aarch64 steps: - uses: actions/checkout@v3 - uses: teaxyz/setup@v0 - name: cache node_modules build # TODO: cache issue in our self-hosted macos runner ESPIPE: invalid seek, read # but its ok to ignore, its still the fastest builder # NOTE: enabling cache in the self hosted runner slows down the pipeline by 4m because post-cache builder error ^ if: startsWith(matrix.platform.name, 'linux') || matrix.platform.name == 'darwin+x86-64' uses: actions/cache@v3 with: key: ${{matrix.platform.name}}-pnpm-prod path: | ./pnpm ./.pnpm-store ./node_modules ./modules/desktop/node_modules ./modules/ui/node_modules - name: cache electron build uses: actions/cache@v3 with: key: ${{matrix.platform.name}}-electron-prod path: | ./modules/desktop/.svelte-kit ./modules/desktop/build ./modules/desktop/dist - name: build if: startsWith(matrix.platform.name, 'darwin') run: tea -ES xc dist env: USE_HARD_LINKS: false CSC_LINK: ${{ secrets.GUI_APPLE_CERTIFICATE }} CSC_KEY_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }} CSC_NAME: ${{ secrets.APPLE_IDENTITY_NO_PREFIX }} # APPLE_ID: ${{ secrets.APPLE_ID }} # APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }} - run: mkdir -p target - run: cp ./modules/desktop/dist/*.zip ./target/tea.zip - run: tar -czvf artifacts.tgz -C ./target/ . - name: upload artifacts uses: actions/upload-artifact@v3 with: name: ${{ matrix.platform.name }} path: artifacts.tgz if-no-files-found: error notarize_desktop: needs: [build_desktop] runs-on: macos-11 strategy: matrix: platform: - darwin+x86-64 - darwin+aarch64 steps: - uses: actions/download-artifact@v3 with: name: ${{ matrix.platform }} - run: tar xzf artifacts.tgz - run: cd ./macos/ && zip -r tea.zip tea.app # Notarize. Can take up to 10 minutes (and fail) asynchronously - run: xcrun altool --notarize-app --username "$APPLE_ID" --password "$APPLE_PASSWORD" --primary-bundle-id "com.tea.xyz" --file ./macos/tea.zip env: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} upload: needs: [build_desktop, notarize_desktop] runs-on: ubuntu-latest strategy: matrix: platform: - darwin+x86-64 # - linux+x86-64 - darwin+aarch64 # - linux+aarch64 steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 with: name: ${{ matrix.platform }} - run: tar xzf artifacts.tgz - name: Get current unix ts - seconds id: date run: echo "unix_seconds=$(date +'%s')" >> $GITHUB_OUTPUT - uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: build platform output id: build_platform env: platform: ${{ matrix.platform }} run: | BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g") EXTENSION=dmg case $platform in "linux+x86-64") BUILD_PLATFORM="amd64" EXTENSION="deb" ;; "linux+aarch64") BUILD_PLATFORM="aarch64" EXTENSION="deb" ;; "darwin+aarch64") BUILD_PLATFORM="aarch64" EXTENSION="zip" ;; "darwin+x86-64") BUILD_PLATFORM="x64" EXTENSION="zip" ;; *) echo "Unknown platform $platform" exit 1 ;; esac echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT echo "extension=$EXTENSION" >> $GITHUB_OUTPUT - name: cp package images from prod to gui bucket env: platform: ${{ steps.build_platform.outputs.build_platform }} build_platform: ${{ matrix.platform }} extension: ${{steps.build_platform.outputs.extension}} run: | aws s3 cp \ "./tea.$extension" \ "s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}_$platform.$extension" - name: cp package zip for MacOS env: platform: ${{ steps.build_platform.outputs.build_platform }} build_platform: ${{ matrix.platform }} extension: ${{ steps.build_platform.outputs.extension }} run: | aws s3 cp ./macos/tea.zip \ "s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}_$platform.$extension" - uses: actions/setup-node@v3 with: node-version: 18 - name: Slack Notification run: ./.github/notify-slack.js env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} PLATFORM: ${{ matrix.platform }} EXT: ${{ steps.build_platform.outputs.extension }} DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_${{ steps.date.outputs.unix_seconds }}_${{ steps.build_platform.outputs.build_platform }}.${{ steps.build_platform.outputs.extension }}