Skip to content

Commit

Permalink
ci: resolve ref across different triggers and use resolved ref throug…
Browse files Browse the repository at this point in the history
…hout release-final
  • Loading branch information
angusbayley committed Dec 17, 2024
1 parent eafb5d9 commit 5478bf4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/release-final.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ jobs:
env:
NODE_OPTIONS: "--max-old-space-size=7168"
steps:
- name: Set resolved_ref
id: set-resolved-ref
run: |
if [ "${{ inputs.ref }}" ]; then
echo "resolved_ref=${{ inputs.ref }}" >> $GITHUB_ENV
else
if ${{ contains(github.event.workflow_run.name, '(Hotfix)') }}; then
echo "resolved_ref=hotfix" >> $GITHUB_ENV
else
echo "resolved_ref=main" >> $GITHUB_ENV
fi
fi
shell: bash
- name: generate token
id: generate-token
uses: tibdex/github-app-token@v1
Expand All @@ -39,7 +52,7 @@ jobs:
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
ref: ${{ env.resolved_ref }}
fetch-depth: 2
token: ${{ steps.generate-token.outputs.token }}
- name: Setup git user
Expand Down Expand Up @@ -118,7 +131,7 @@ jobs:
git tag live-mobile@${{ steps.mobile-version.outputs.version }}
- name: push changes
run: |
git push origin ${{ inputs.ref }} --tags
git push origin ${{ env.resolved_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 @@ -143,7 +156,7 @@ jobs:
ref: "main",
workflow_id: "release-desktop.yml",
inputs: {
branch: "${{ inputs.ref }}"
branch: "${{ env.resolved_ref }}"
}
});
- uses: actions/github-script@v7
Expand All @@ -158,6 +171,6 @@ jobs:
ref: "main",
workflow_id: "release-mobile.yml",
inputs: {
ref: "${{ inputs.ref }}"
ref: "${{ env.resolved_ref }}"
}
});

0 comments on commit 5478bf4

Please sign in to comment.