Skip to content

Commit 5508e86

Browse files
committed
build: cache macos builds + release
1 parent 26b4c53 commit 5508e86

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

.github/workflows/build.yaml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,38 @@ jobs:
7878
name: guppy
7979
path: ./cli/dist/guppy
8080
retention-days: 1
81-
82-
build_macos:
81+
82+
check_macos_cache:
8383
needs: [check_cli_cache, build_cli]
8484
if: always()
85+
runs-on: ubuntu-latest
86+
outputs:
87+
cache-hit: ${{ steps.cache.outputs.cache-hit }}
88+
steps:
89+
- name: Check CLI cache
90+
id: cache
91+
uses: actions/cache@v4
92+
with:
93+
path: ./macos/build
94+
key: macos-${{ hashFiles('macos/[!build]**', 'maco/**/[!build]**') }}
95+
96+
- name: Upload macOS app
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: guppy-${{ needs.check_cli_cache.outputs.version }}.pkg
100+
path: ./macos/build/guppy-${{ needs.check_cli_cache.outputs.version }}.pkg
101+
retention-days: 1
102+
103+
build_macos:
104+
needs: [check_cli_cache, build_cli, check_macos_cache]
105+
if: always() && needs.check_cli_cache.outputs.cache-hit != 'true'
85106
runs-on: macos-latest
86107
steps:
87108
- uses: actions/checkout@v4
88109

110+
- id: cachekey
111+
run: echo "cachekey=${{ hashFiles('macos/[!build]**', 'maco/**/[!build]**') }}" >> $GITHUB_OUTPUT
112+
89113
- name: Restore CLI from cache
90114
uses: actions/cache/restore@v4
91115
with:
@@ -163,6 +187,12 @@ jobs:
163187
--component ./macos/build/guppy.app /Applications \
164188
./macos/build/guppy-${{ needs.check_cli_cache.outputs.version }}.pkg
165189
190+
- name: Save to cache
191+
uses: actions/cache/save@v4
192+
with:
193+
path: ./macos/build
194+
key: macos-${{ steps.cachekey.outputs.cachekey }}
195+
166196
- name: Upload macOS app
167197
uses: actions/upload-artifact@v4
168198
with:

.github/workflows/release.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
if: always() && !failure() && !cancelled()
6969
runs-on: ubuntu-latest
7070
steps:
71+
- uses: actions/checkout@v4
72+
7173
- name: Download CLI artifact
7274
uses: actions/download-artifact@v4
7375
with:
@@ -90,9 +92,9 @@ jobs:
9092
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9193
VERSION: ${{ needs.promote_to_release.outputs.version }}
9294
run: |
93-
gh release create "$VERSION" \
94-
--title "Guppy $VERSION" \
95+
gh release create "v$VERSION" \
96+
--title "Guppy v$VERSION" \
9597
--draft \
96-
--notes "Release notes for $VERSION" \
98+
--notes "Release notes for v$VERSION" \
9799
"./cli/dist/guppy" \
98100
"./macos/build/guppy-$VERSION.pkg"

0 commit comments

Comments
 (0)