chore(prerelease): 🚀 release prerelease [LLD(2.85.0-next.0), L… #1277
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: "[Release](Prerelease) Publish packages and apps" | |
on: | |
push: | |
branches: | |
- release | |
- hotfix | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: the branch to prerelease from | |
required: true | |
jobs: | |
prerelease: | |
name: Prerelease | |
runs-on: ubuntu-latest | |
env: | |
NODE_OPTIONS: "--max-old-space-size=7168" | |
steps: | |
- name: generate token | |
id: generate-token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.GH_BOT_APP_ID }} | |
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
with: | |
ref: ${{ inputs.ref }} | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Setup git user | |
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-git-user@develop | |
- name: Setup the toolchain | |
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-toolchain@develop | |
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop | |
id: desktop-version | |
with: | |
path: ${{ github.workspace }}/apps/ledger-live-desktop | |
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop | |
id: mobile-version | |
with: | |
path: ${{ github.workspace }}/apps/ledger-live-mobile | |
- name: install dependencies | |
run: pnpm i -F "ledger-live" -F "{libs/**}..." -F "@ledgerhq/live-cli" | |
- name: build libs | |
run: pnpm run build:libs | |
- name: versioning | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm changeset version | |
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop | |
id: post-desktop-version | |
with: | |
path: ${{ github.workspace }}/apps/ledger-live-desktop | |
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop | |
id: post-mobile-version | |
with: | |
path: ${{ github.workspace }}/apps/ledger-live-mobile | |
- name: commit (from release branch) | |
if: ${{ startsWith(github.ref_name, 'release') }} | |
env: | |
LLD: LLD(${{ steps.post-desktop-version.outputs.version }}) | |
LLM: LLM(${{ steps.post-mobile-version.outputs.version }}) | |
run: | | |
git add . && | |
git commit -m "chore(prerelease): :rocket: release prerelease [${{ env.LLD }}, ${{ env.LLM }}]" || | |
echo "" | |
- name: commit (from hotfix branch) | |
if: ${{ startsWith(github.ref_name, 'hotfix') }} | |
env: | |
LLD: LLD(${{ steps.post-desktop-version.outputs.version }}) | |
LLM: LLM(${{ steps.post-mobile-version.outputs.version }}) | |
run: | | |
git add . && | |
git commit -m "chore(hotfix): :fire: hotfix prerelease [${{ env.LLD }}, ${{ env.LLM }}]" || | |
echo "" | |
- name: commit (from ${{ inputs.ref }} branch) workflow dispatch | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
git add . | |
git commit -m "chore(prerelease): :rocket: ${{ inputs.ref }} prerelease [LLD(${{ steps.post-desktop-version.outputs.version }}), LLM(${{ steps.post-mobile-version.outputs.version }})]" || | |
echo "" | |
- name: publish prerelease | |
run: pnpm changeset publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
- name: tag desktop | |
if: ${{ steps.desktop-version.outputs.version != steps.post-desktop-version.outputs.version }} | |
run: | | |
git tag @ledgerhq/live-desktop@${{ steps.post-desktop-version.outputs.version }} | |
- name: tag mobile | |
if: ${{ steps.mobile-version.outputs.version != steps.post-mobile-version.outputs.version }} | |
run: | | |
git tag live-mobile@${{ steps.post-mobile-version.outputs.version }} | |
- name: push changes (push event) | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
git pull --rebase | |
git push origin ${{ github.ref_name }} --follow-tags | |
- name: push changes (other events) | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
git pull --rebase | |
git push origin ${{ inputs.ref }} --follow-tags | |
- uses: actions/github-script@v6 | |
name: trigger prerelease build for desktop | |
if: ${{ steps.desktop-version.outputs.version != steps.post-desktop-version.outputs.version }} | |
with: | |
github-token: ${{ steps.generate-token.outputs.token }} | |
script: | | |
github.rest.actions.createWorkflowDispatch({ | |
owner: "ledgerhq", | |
repo: "ledger-live-build", | |
ref: "main", | |
workflow_id: "pre-desktop.yml", | |
inputs: { | |
ref: "${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}", | |
} | |
}); | |
- uses: actions/github-script@v6 | |
name: trigger prerelease build of mobile | |
if: ${{ steps.mobile-version.outputs.version != steps.post-mobile-version.outputs.version }} | |
with: | |
github-token: ${{ steps.generate-token.outputs.token }} | |
script: | | |
github.rest.actions.createWorkflowDispatch({ | |
owner: "ledgerhq", | |
repo: "ledger-live-build", | |
ref: "main", | |
workflow_id: "pre-mobile.yml", | |
inputs: { | |
ref: "${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}", | |
} | |
}); |