Skip to content

Commit 95c729b

Browse files
committed
Add the magic nix cachebinaryrevision tothe state file
1 parent f0d2949 commit 95c729b

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

tools/state.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"upstream_action_revision": "cb3030da0487efd312ad3c07fc4ad1960d35ec60",
3-
"source_tag": "v3.6.2",
2+
"upstream_action_revision": "def9f5a5c6a6b8751c0534e8813a5d0ad2635660",
3+
"source_tag": "2.1",
4+
"binary_revision": "c79f1550609d4e9c4065a27fd599e76a94e0278d",
45
"checkout_action_tag": "v4.2.2"
56
}

tools/update-state.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ default_branch() {
1111
}
1212

1313
get_latest_revision() {
14-
gh api "repos/$REPO/commits/$(default_branch)" \
14+
gh api "repos/$1/commits/$(default_branch)" \
1515
| jq -r '.sha'
1616
}
1717

@@ -24,6 +24,20 @@ checkout_tag() {
2424
--json isLatest,tagName
2525
}
2626

27+
magic_nix_cache_binary_rev() {
28+
sha=$(get_latest_revision "DeterminateSystems/magic-nix-cache")
29+
30+
(
31+
echo "Checking to see if $sha for magic-nix-cache has binaries yet..."
32+
for arch in ARM64-macOS X64-macOS X64-Linux ARM64-Linux; do
33+
curl -LI --fail \
34+
https://install.determinate.systems/magic-nix-cache/rev/$sha/$arch
35+
done
36+
) >&2
37+
38+
echo "$sha"
39+
}
40+
2741
determinate_nix_action_major() {
2842
gh release list \
2943
--repo DeterminateSystems/determinate-nix-action \
@@ -34,12 +48,14 @@ determinate_nix_action_major() {
3448
}
3549

3650
main() {
37-
revision=$(get_latest_revision)
51+
revision=$(get_latest_revision "$REPO")
3852
checkout_tag=$(checkout_tag)
53+
mnc_binary_rev=$(magic_nix_cache_binary_rev)
3954

4055
jq -n '$ARGS.named' \
4156
--arg upstream_action_revision "$revision" \
4257
--arg "source_tag" "$MAGIC_NIX_CACHE_TAG" \
58+
--arg "binary_revision" "$mnc_binary_rev" \
4359
--arg "checkout_action_tag" "$checkout_tag" \
4460
| cat > tools/state.json
4561
}

0 commit comments

Comments
 (0)