Skip to content

Commit

Permalink
Merge pull request #8264 from LedgerHQ/support/post-ghost-release-hot…
Browse files Browse the repository at this point in the history
…fix-workflow

[DNM] Post-"ghost"-release hotfix workflow
  • Loading branch information
angusbayley authored Dec 2, 2024
2 parents 995b771 + 78680a6 commit 49bd68b
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 7 deletions.
35 changes: 33 additions & 2 deletions .github/workflows/release-create-hotfix.yml
Original file line number Diff line number Diff line change
@@ -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: application (LLM | LLD)
required: true
type: choice
options:
- LLM
- LLD

jobs:
create-hotfix:
Expand All @@ -15,10 +27,25 @@ jobs:
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}

- name: Checkout composite actions
uses: actions/checkout@v4
with:
ref: develop
sparse-checkout: tools/actions/composites

- name: Generate ref/tag version to use during main checkout
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 }}

- uses: actions/checkout@v4
with:
ref: main
ref: ${{ steps.format-app-tag.outputs.main_ref }}
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
Expand Down Expand Up @@ -61,6 +88,10 @@ jobs:
- 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
gh pr create \
--title ":fire: Hotfix ${{ steps.date.outputs.date }} (targeting ${{ github.event.inputs.application }} ${{ github.event.inputs.tag_version }})"\
-F ./.github/templates/hotfix.md \
--base main \
--head hotfix
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
12 changes: 8 additions & 4 deletions .github/workflows/release-final.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
- LLD
- LLM
- ALL
ref:
description: "the ref (branch) to release from"
required: false
default: main

workflow_run:
workflows:
Expand All @@ -35,7 +39,7 @@ jobs:
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
ref: main
ref: ${{ inputs.ref }}
fetch-depth: 2
token: ${{ steps.generate-token.outputs.token }}
- name: Setup git user
Expand Down Expand Up @@ -114,7 +118,7 @@ jobs:
git tag live-mobile@${{ steps.mobile-version.outputs.version }}
- name: push changes
run: |
git push origin main --tags
git push origin ${{ inputs.ref }} --tags
- name: create desktop github release
if: ${{ steps.desktop-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLD", "ALL"]'), inputs.app) }}
env:
Expand All @@ -139,7 +143,7 @@ jobs:
ref: "main",
workflow_id: "release-desktop.yml",
inputs: {
branch: "main"
branch: ${{ inputs.ref }}
}
});
- uses: actions/github-script@v7
Expand All @@ -154,6 +158,6 @@ jobs:
ref: "main",
workflow_id: "release-mobile.yml",
inputs: {
ref: "main"
ref: ${{ inputs.ref }}
}
});
29 changes: 28 additions & 1 deletion .github/workflows/release-prepare-hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ on:
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:
Expand All @@ -21,6 +32,19 @@ jobs:
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:
Expand Down Expand Up @@ -55,19 +79,21 @@ jobs:
- name: push changes
run: |
git push origin ${{ inputs.ref }}
git fetch origin
- 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: |
Expand All @@ -77,6 +103,7 @@ jobs:
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: |
Expand Down
38 changes: 38 additions & 0 deletions tools/actions/composites/generate-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Format Application Tag"
description: "Generates the ref/tag version for main checkout. Returns `main` if no tag_version supplied"
inputs:
tag_version:
description: "The version tag to format (e.g. 2.91.0)"
default: "latest"
required: false
application:
description: "The application to use (LLM or LLD)"
required: true
outputs:
main_ref:
description: "Formatted application and tag version"
value: ${{ steps.format-tag.outputs.main_ref }}

runs:
using: "composite"
steps:
- name: Generate ref/tag version
id: format-tag
shell: bash
run: |
if [ "${{ inputs.tag_version }}" = "latest" ]; then
main_ref="main"
else
if [ "${{ inputs.application }}" = "LLM" ]; then
formatted_app="live-mobile"
elif [ "${{ inputs.application }}" = "LLD" ]; then
formatted_app="@ledgerhq/live-desktop"
else
echo "Unknown application"
exit 1
fi
main_ref="${formatted_app}@${{ inputs.tag_version }}"
fi
echo "Tag/ref generated: ${main_ref}"
echo "main_ref=${main_ref}" >> $GITHUB_OUTPUT

0 comments on commit 49bd68b

Please sign in to comment.