Skip to content

[Desktop] - Build - Called #200

[Desktop] - Build - Called

[Desktop] - Build - Called #200

name: "[Desktop] - Build - Called"
on:
workflow_call:
workflow_dispatch:
inputs:
ref:
description: |
If you run this manually, and want to run on a PR, the correct ref should be refs/pull/{PR_NUMBER}/merge to
have the "normal" scenario involving checking out a merge commit between your branch and the base branch.
If you want to run only on a branch or specific commit, you can use either the sha or the branch name instead (prefer the first verion for PRs).
type: string
required: false
login:
description: The GitHub username that triggered the workflow
type: string
required: false
base_ref:
description: The base branch to merge the head into when checking out the code
type: string
required: false
permissions:
id-token: write
contents: read
pull-requests: write
jobs:
build-desktop-app:
strategy:
fail-fast: false
matrix:
config:
[
{
name: "Linux",
os: "ledger-live-linux-8CPU-32RAM",
image: "linux-x86_64.AppImage",
output-name: "linux",
},
{
name: "Windows",
os: "windows-2022",
dotnet: true,
image: "win-x64.exe",
output-name: "win",
},
{ name: "macOS", os: "macos-14", image: "mac.dmg", output-name: "mac" },
]
name: "${{ matrix.config.name }} Build"
runs-on: ${{ matrix.config.os }}
timeout-minutes: 20
outputs:
linux: ${{ steps.status.outputs.Linux }}
win: ${{ steps.status.outputs.Windows }}
mac: ${{ steps.status.outputs.macOS }}
env:
NODE_OPTIONS: "--max-old-space-size=7168"
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ inputs.ref || github.sha }}
- name: Setup git user
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-git-user@develop
- name: Setup the caches
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@support/LIVE-26911-add-mise
id: setup-caches
with:
install-proto: true
skip-turbo-cache: "false"
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
region: ${{ secrets.AWS_CACHE_REGION }}
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
- name: Build desktop
id: build-desktop
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-build-desktop@support/LIVE-26911-add-mise
with:
os: ${{ matrix.config.output-name }}
- name: Build the app
id: build-app
run: pnpm build:lld --api="http://127.0.0.1:${{ steps.setup-caches.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
env:
GENERATE_METAFILES: "lite"
- name: Upload ${{ matrix.config.name }} app
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ steps.build-desktop.outputs.version }}-${{ matrix.config.image }}
path: ${{ github.workspace }}/apps/ledger-live-desktop/dist/ledger-live-desktop-${{ steps.build-desktop.outputs.version }}-${{ matrix.config.image }}
- name: Upload bundle metafiles
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: ${{ !cancelled() }}
with:
name: ${{ matrix.config.output-name }}-js-bundle-metafiles
path: ${{ github.workspace }}/apps/ledger-live-desktop/metafile.*
- name: Push status
id: status
shell: bash
if: ${{ !cancelled() }}
run: echo "${{ matrix.config.name }}=${{ steps.build-app.outcome }}" >> $GITHUB_OUTPUT
report:
name: "Build Desktop > Report"
needs: build-desktop-app
runs-on: ubuntu-22.04
timeout-minutes: 5
if: ${{ !cancelled() && (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || github.event_name == 'pull_request' || github.event_name == 'push') && needs.build-desktop-app.outputs.linux == 'success' && needs.build-desktop-app.outputs.win == 'success' && needs.build-desktop-app.outputs.mac == 'success' }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ inputs.ref || github.sha }}
- name: generate token
id: generate-token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # 2.2.1
with:
app-id: ${{ secrets.GH_BOT_APP_ID }}
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
if: ${{ needs.build-desktop-app.outputs.linux == 'success' }}
with:
name: linux-js-bundle-metafiles
path: linux-js-bundle-metafiles
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
if: ${{ needs.build-desktop-app.outputs.win == 'success' }}
with:
name: win-js-bundle-metafiles
path: win-js-bundle-metafiles
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
if: ${{ needs.build-desktop-app.outputs.mac == 'success' }}
with:
name: mac-js-bundle-metafiles
path: mac-js-bundle-metafiles
- uses: actions/github-script@v7
name: Produce statuses of builds
id: statuses
with:
result-encoding: string
script: |
const obj = {
linux: "${{ needs.build-desktop-app.outputs.linux }}",
win: "${{ needs.build-desktop-app.outputs.win }}",
mac: "${{ needs.build-desktop-app.outputs.mac }}"
}
return JSON.stringify(obj);
- uses: LedgerHQ/ledger-live/tools/actions/build-checks@develop
if: ${{ !cancelled() && github.event.number != '' }}
with:
token: ${{ steps.generate-token.outputs.token }}
baseBranch: ${{ inputs.base_ref || 'develop' }}
prNumber: ${{ github.event.number}}
mode: desktop
- uses: LedgerHQ/ledger-live/tools/actions/desktop-report-build@develop
name: Report summary
with:
token: ${{ steps.generate-token.outputs.token }}
statuses: ${{ steps.statuses.outputs.result }}
attempt: ${{ github.run_attempt }}
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
name: Upload output
with:
path: ${{ github.workspace }}/summary-build-desktop.json
name: summary-build-desktop.json