[Release] - Prepare & Publish Hotfix - Manual #80
This file contains hidden or 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](Hotfix) Prepare for releasing" | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: the branch to release from | |
default: hotfix | |
required: true | |
tag_version: | |
description: version to hotfix (e.g. 2.91.0) | |
default: latest | |
required: false | |
application: | |
description: application (LLM | LLD) | |
required: true | |
type: choice | |
options: | |
- LLM | |
- LLD | |
jobs: | |
prepare-release: | |
name: Prepare Hotfix | |
runs-on: ubuntu-24.04 | |
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 }} | |
- name: Checkout composite actions | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: tools/actions/composites | |
- name: Generate ref/tag version to use when running changeset status | |
uses: LedgerHQ/ledger-live/tools/actions/composites/generate-tag@develop | |
id: format-app-tag | |
with: | |
tag_version: ${{ github.event.inputs.tag_version }} | |
application: ${{ github.event.inputs.application }} | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
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 caches | |
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop | |
id: setup-caches | |
with: | |
install-proto: true | |
- name: install dependencies | |
run: pnpm i -F "ledger-live" | |
- name: exit prerelease mode | |
run: pnpm changeset pre exit | |
- name: versioning | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm changeset version | |
- name: git add | |
run: | | |
git add . | |
- name: commit | |
uses: planetscale/[email protected] | |
with: | |
commit_message: "chore(hotfix): :fire: hotfix release [skip ci]" | |
repo: ${{ github.repository }} | |
branch: ${{ inputs.ref }} | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
- name: pull commit | |
run: | | |
git stash | |
git pull | |
- name: fetch develop and main | |
if: ${{ github.event.inputs.tag_version == 'latest' }} | |
run: | | |
git fetch origin develop main | |
- name: merge into main | |
if: ${{ github.event.inputs.tag_version == 'latest' }} | |
run: | | |
git checkout main | |
git merge ${{ inputs.ref }} --no-ff | |
git push origin main | |
- name: create PR to develop | |
if: ${{ github.event.inputs.tag_version == 'latest' }} | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
git checkout ${{ github.event.inputs.ref }} | |
git checkout -b support/hotfix-merge-conflicts | |
git push origin support/hotfix-merge-conflicts | |
gh pr create --title ":rotating_light: Hotfix merge conflicts" -F .github/templates/hotfix-conflicts.md --base develop --head support/hotfix-merge-conflicts | |
- name: merge into release if present | |
if: ${{ github.event.inputs.tag_version == 'latest' }} | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
if git checkout release | |
then | |
if git merge ${{ github.event.inputs.ref }} --no-ff | |
then | |
git push origin release | |
else | |
git merge --abort | |
git checkout ${{ github.event.inputs.ref }} | |
git checkout -b support/hotfix-release-merge-conflicts | |
git push origin support/hotfix-release-merge-conflicts | |
gh pr create --title ":rotating_light: Hotfix Release merge conflicts" -F .github/templates/hotfix-release-conflicts.md --base release --head support/hotfix-release-merge-conflicts | |
fi | |
fi | |
release-final: | |
name: "[Release] Publish packages and apps" | |
needs: prepare-release | |
uses: LedgerHQ/ledger-live/.github/workflows/release-final.yml@develop | |
with: | |
# release from main if hotfixing the latest version, otherwise from the hotfix branch | |
# For more info about why we do this, see this doc: | |
# https://ledgerhq.atlassian.net/wiki/spaces/WALLETCO/pages/4710989838/LL+Incident+Recovery+-+Hotfix+in+all+cases | |
ref: ${{ github.event.inputs.tag_version == 'latest' && 'main' || 'hotfix' }} | |
caller: release-prepare-hotfix | |
secrets: inherit |