name: Build and Publish
author: Erwan Guyader
description: Builds Cozy Desktop binaries and publish them to the latest Github release draft.
inputs:
  gh-token:
    description: 'The Github token used to attach binaries to releases.'
    required: true
  mac-cert:
    description: 'The code signing certificate encoded in base64.'
    required: false
  mac-cert-password:
    description: 'The code signing certificate password.'
    required: false
  apple-id:
    description: 'The Apple notarization account id.'
    required: false
  apple-id-password:
    description: 'The Apple notarization account password.'
    required: false
runs:
  using: composite
  steps:
    - shell: bash
      env:
        GH_TOKEN: "${{ inputs.gh-token }}"
        CSC_FOR_PULL_REQUEST: true
        CSC_LINK: "${{ inputs.mac-cert }}"
        CSC_KEY_PASSWORD: "${{ inputs.mac-cert-password }}"
        APPLE_ID: "${{ inputs.apple-id }}"
        APPLE_ID_PASSWORD: "${{ inputs.apple-id-password }}"
      run: |
        if [ "${{ runner.os }}" == "Linux" ]; then
          # Install build dependencies:
          # - `libopenjp2-tools` for the basic build
          # - the others for cross-compiling 32 bit apps on a 64 bit machine
          sudo apt update
          sudo apt install --no-install-recommends -y libopenjp2-tools gcc-multilib g++-multilib
        fi
        yarn dist:all

name: Build and Publish
author: Erwan Guyader
description: Builds Cozy Desktop binaries and publish them to the latest Github release draft.
inputs:
  gh-token:
    description: 'The Github token used to attach binaries to releases.'
    required: true
  mac-cert:
    description: 'The code signing certificate encoded in base64.'
    required: false
  mac-cert-password:
    description: 'The code signing certificate password.'
    required: false
  apple-id:
    description: 'The Apple notarization account id.'
    required: false
  apple-id-password:
    description: 'The Apple notarization account password.'
    required: false
runs:
  using: composite
  steps:
    - shell: bash
      env:
        GH_TOKEN: "${{ inputs.gh-token }}"
        CSC_FOR_PULL_REQUEST: true
        CSC_LINK: "${{ inputs.mac-cert }}"
        CSC_KEY_PASSWORD: "${{ inputs.mac-cert-password }}"
        APPLE_ID: "${{ inputs.apple-id }}"
        APPLE_ID_PASSWORD: "${{ inputs.apple-id-password }}"
      run: |
        if [ "${{ runner.os }}" == "Linux" ]; then
          # Install build dependencies:
          # - `libopenjp2-tools` for the basic build
          # - the others for cross-compiling 32 bit apps on a 64 bit machine
          sudo apt update
          sudo apt install --no-install-recommends -y libopenjp2-tools gcc-multilib g++-multilib
        fi
        yarn dist --x64

Stop building 32-bit Linux binaries
ci: Stop building 32-bit Linux binaries

  32-bit Linux binaries are not supported by Electron since v6 and all
  remaining libraries have been removed in v19 so these cannot be built
  anymore.
  Since we don't build 32-bit macOS binaries, we can force the
  `build-and-publish` action to build only 64-bit binaries.
