From d3e0b35803b60484bd8b1e2b96841f7d5a9fbfd5 Mon Sep 17 00:00:00 2001 From: Angus Bayley Date: Thu, 31 Oct 2024 12:44:19 +0000 Subject: [PATCH] prelease: hotfix from a specific released version --- .github/workflows/release-create-hotfix.yml | 90 ++++++++++++++------- 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release-create-hotfix.yml b/.github/workflows/release-create-hotfix.yml index b2e9cd1ee7a4..76c5fa29a39f 100644 --- a/.github/workflows/release-create-hotfix.yml +++ b/.github/workflows/release-create-hotfix.yml @@ -1,6 +1,18 @@ name: "[Release](Hotfix) Create Branch" on: workflow_dispatch: + inputs: + tag_version: + description: the tag/release version to hotfix + default: latest + required: false + application: + description: the application to release (LLM | LLD) + required: true + type: choice + options: + - LLM + - LLD jobs: create-hotfix: @@ -15,32 +27,56 @@ jobs: with: app_id: ${{ secrets.GH_BOT_APP_ID }} private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }} - - uses: actions/checkout@v4 - with: - ref: main - token: ${{ steps.generate-token.outputs.token }} - - name: Setup git user - uses: LedgerHQ/ledger-live/tools/actions/composites/setup-git-user@develop - - name: create hotfix branch - run: | - git checkout -b hotfix - - name: Setup the toolchain - uses: LedgerHQ/ledger-live/tools/actions/composites/setup-toolchain@develop - - name: install dependencies - run: pnpm i -F "ledger-live" - - name: enter prerelease mode - run: pnpm changeset pre enter hotfix - - name: commit - run: | - git add . - git commit -m "chore(hotfix) :rocket: entering hotfix mode" - - name: Get date - id: date + + - name: Format application and tag version + id: format-app-tag run: | - echo "date=$(date +%F)" >> $GITHUB_OUTPUT - - name: push + if [ ${{ github.event.inputs.tag_version }} = 'latest' ]; then + ref="main" + else + if [ "${{ github.event.inputs.application }}" = "LLM" ]; then + formatted_app="live-mobile" + elif [ "${{ github.event.inputs.application }}" = "LLD" ]; then + formatted_app="@ledgerhq/live-desktop" + else + echo "Unknown application" + exit 1 + fi + ref="${formatted_app}@${{ github.event.inputs.tag_version }}" + fi + + echo "ref=$ref" >> $GITHUB_ENV + + - name: Output formatted application and tag version run: | - git push origin hotfix - gh pr create --title ":fire: Hotfix ${{ steps.date.outputs.date }}" -F ./.github/templates/hotfix.md --base main --head hotfix - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + echo "Formatted application and tag version: $ref" + + # - uses: actions/checkout@v4 + # with: + # ref: ${{ inputs.tag_version == 'latest' && 'main' || inputs.tag_version }} #### FINISH + # token: ${{ steps.generate-token.outputs.token }} + # - name: Setup git user + # uses: LedgerHQ/ledger-live/tools/actions/composites/setup-git-user@develop + # - name: create hotfix branch + # run: | + # git checkout -b hotfix + # - name: Setup the toolchain + # uses: LedgerHQ/ledger-live/tools/actions/composites/setup-toolchain@develop + # - name: install dependencies + # run: pnpm i -F "ledger-live" + # - name: enter prerelease mode + # run: pnpm changeset pre enter hotfix + # - name: commit + # run: | + # git add . + # git commit -m "chore(hotfix) :rocket: entering hotfix mode" + # - name: Get date + # id: date + # run: | + # echo "date=$(date +%F)" >> $GITHUB_OUTPUT + # - name: push + # run: | + # git push origin hotfix + # gh pr create --title ":fire: Hotfix ${{ steps.date.outputs.date }}" -F ./.github/templates/hotfix.md --base main --head hotfix + # env: + # GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}