Skip to content

Commit 26b4c53

Browse files
committed
build: fallback build on release
1 parent ba243c6 commit 26b4c53

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- main
77
workflow_dispatch:
8+
workflow_call:
89

910
jobs:
1011
check_cli_cache:

.github/workflows/release.yaml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ permissions:
1313
jobs:
1414
promote_to_release:
1515
runs-on: ubuntu-latest
16+
outputs:
17+
version: ${{ steps.gitversion.outputs.MajorMinorPatch }}
18+
build_run_id: ${{ steps.build-run.outputs.run_id }}
1619
steps:
1720
- uses: actions/checkout@v4
1821
with:
@@ -40,22 +43,52 @@ jobs:
4043

4144
- name: Download CLI artifact
4245
uses: actions/download-artifact@v4
46+
if: steps.build-run.outputs.run_id != ''
4347
with:
4448
name: guppy
4549
path: ./cli/dist
4650
run-id: ${{ steps.build-run.outputs.run_id }}
4751

4852
- name: Download macOS artifact
4953
uses: actions/download-artifact@v4
54+
if: steps.build-run.outputs.run_id != ''
5055
with:
5156
name: guppy-${{ steps.gitversion.outputs.MajorMinorPatch }}.pkg
5257
path: ./macos/build
5358
run-id: ${{ steps.build-run.outputs.run_id }}
5459

60+
build:
61+
needs: promote_to_release
62+
if: needs.promote_to_release.outputs.build_run_id == ''
63+
uses: ./.github/workflows/build.yaml
64+
secrets: inherit
65+
66+
create_release:
67+
needs: [promote_to_release, build]
68+
if: always() && !failure() && !cancelled()
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Download CLI artifact
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: guppy
75+
path: ./cli/dist
76+
run-id: ${{ needs.promote_to_release.outputs.build_run_id != '' && needs.promote_to_release.outputs.build_run_id || github.run_id }}
77+
78+
- name: Download macOS artifact
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: guppy-${{ needs.promote_to_release.outputs.version }}.pkg
82+
path: ./macos/build
83+
run-id: ${{ needs.promote_to_release.outputs.build_run_id != '' && needs.promote_to_release.outputs.build_run_id || github.run_id }}
84+
85+
- name: Make CLI executable
86+
run: chmod +x ./cli/dist/guppy
87+
5588
- name: Create Release
5689
env:
5790
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
VERSION: ${{ steps.gitversion.outputs.MajorMinorPatch }}
91+
VERSION: ${{ needs.promote_to_release.outputs.version }}
5992
run: |
6093
gh release create "$VERSION" \
6194
--title "Guppy $VERSION" \

0 commit comments

Comments
 (0)