Skip to content

Commit 0b64f10

Browse files
kraenhansenclaude
andcommitted
Skip the Hermes build when the archive is already published
The paths filter fires on any edit to hermes.ts, hermes-prebuilt.ts or this workflow, not just a bumped pin — and `--no-download` meant the run then rebuilt for half an hour and re-uploaded 118 MB identical to what was already on the release. Merging #443 did exactly that. The Actions cache does not cover this: it is scoped to the branch that wrote it, so a build on a feature branch leaves nothing behind for `next`, and it evicts after 7 days idle or under the repository's 10 GB cap, which several multi-gigabyte ccache entries already compete for. The archive name covers every input that changes its contents, so an asset already published under that name is what the run would rebuild. Look it up and skip the build and the upload, with a `force` dispatch input for deliberate rebuilds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UkNbgdyuKgHaFwT27RahGH
1 parent 8f91084 commit 0b64f10

1 file changed

Lines changed: 34 additions & 2 deletions

File tree

.github/workflows/hermes-prebuilt.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ env:
1212

1313
on:
1414
workflow_dispatch:
15+
inputs:
16+
force:
17+
description: Rebuild and re-upload even when the archive is already published
18+
type: boolean
19+
default: false
1520
push:
1621
branches:
1722
- main
@@ -54,7 +59,32 @@ jobs:
5459
tag=$(pnpm exec react-native-node-api prebuilt-hermes --print tag)
5560
echo "archive=$archive" >> "$GITHUB_OUTPUT"
5661
echo "tag=$tag" >> "$GITHUB_OUTPUT"
62+
# The paths filter above fires on any edit to these files, not just a
63+
# bumped pin — and the archive name covers every input that changes its
64+
# contents, so an asset already published under that name is exactly what
65+
# this run would spend half an hour rebuilding. The Actions cache is not
66+
# enough on its own: it is scoped to the branch that wrote it, and evicts
67+
# after 7 days or under the repository's 10 GB cap.
68+
- name: Look for an already-published archive
69+
id: published
70+
env:
71+
GH_TOKEN: ${{ github.token }}
72+
TAG: ${{ steps.hermes.outputs.tag }}
73+
ARCHIVE: ${{ steps.hermes.outputs.archive }}
74+
FORCE: ${{ inputs.force }}
75+
run: |
76+
if [ "$FORCE" = "true" ]; then
77+
echo "::notice::Forced: rebuilding $ARCHIVE regardless of what is published"
78+
echo "exists=false" >> "$GITHUB_OUTPUT"
79+
elif gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets \
80+
--jq '.assets[].name' 2>/dev/null | grep -qxF "$ARCHIVE"; then
81+
echo "::notice::$ARCHIVE is already published under $TAG — nothing to build"
82+
echo "exists=true" >> "$GITHUB_OUTPUT"
83+
else
84+
echo "exists=false" >> "$GITHUB_OUTPUT"
85+
fi
5786
- name: Cache prebuilt Hermes
87+
if: steps.published.outputs.exists != 'true'
5888
uses: actions/cache@v6
5989
with:
6090
path: ~/Library/Caches/react-native-node-api/hermes-prebuilt
@@ -63,6 +93,7 @@ jobs:
6393
# it is about to publish.
6494
- name: Build prebuilt Hermes
6595
id: build
96+
if: steps.published.outputs.exists != 'true'
6697
working-directory: apps/test-app
6798
run: |
6899
path=$(pnpm exec react-native-node-api prebuilt-hermes --no-download)
@@ -71,7 +102,7 @@ jobs:
71102
# compiler's actual complaint only in its configure log. Surface that log
72103
# here so a failure is diagnosable without another round trip.
73104
- name: Dump CMake configure log
74-
if: failure()
105+
if: failure() && steps.published.outputs.exists != 'true'
75106
run: |
76107
log=$(find "$PWD" -name CMakeConfigureLog.yaml -path '*build_host_hermesc*' | head -1)
77108
if [ -z "$log" ]; then
@@ -92,7 +123,7 @@ jobs:
92123
echo "::endgroup::"
93124
cp "$log" "$RUNNER_TEMP/CMakeConfigureLog.yaml"
94125
- name: Upload CMake configure log
95-
if: failure()
126+
if: failure() && steps.published.outputs.exists != 'true'
96127
uses: actions/upload-artifact@v7
97128
with:
98129
name: hermesc-cmake-configure-log
@@ -101,6 +132,7 @@ jobs:
101132
# --latest=false keeps these out of the "latest release" slot, which
102133
# belongs to the package releases changesets publishes.
103134
- name: Publish as a release asset
135+
if: steps.published.outputs.exists != 'true'
104136
env:
105137
GH_TOKEN: ${{ github.token }}
106138
TAG: ${{ steps.hermes.outputs.tag }}

0 commit comments

Comments
 (0)