Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3be7774
chore(CI): Update homebrew formula on release
DaughterOfMars Feb 17, 2025
195e0dc
dprint
DaughterOfMars Feb 17, 2025
52ad8f4
temp for testing
DaughterOfMars Mar 3, 2025
92061b4
Merge branch 'develop' into dev-tools/update-homebrew
DaughterOfMars Mar 3, 2025
4bc4c6a
temp for testing
DaughterOfMars Mar 3, 2025
9bedd1d
change runs-on
DaughterOfMars Mar 3, 2025
4695e1c
try something else
DaughterOfMars Mar 3, 2025
d00cdab
try updating action
DaughterOfMars Mar 3, 2025
9f28926
manually create PR
DaughterOfMars Mar 5, 2025
887f292
install homebrew
DaughterOfMars Mar 5, 2025
06b7ff2
remove check
DaughterOfMars Mar 5, 2025
1a35f56
remove dot
DaughterOfMars Mar 5, 2025
202ca23
checkout
DaughterOfMars Mar 5, 2025
c2f4bef
chmod
DaughterOfMars Mar 5, 2025
2ab2e49
fixes
DaughterOfMars Mar 5, 2025
df126a1
quote title
DaughterOfMars Mar 5, 2025
0ae1963
more fixes
DaughterOfMars Mar 5, 2025
d24cc32
try using token
DaughterOfMars Mar 5, 2025
f1b04a7
even more fixes
DaughterOfMars Mar 5, 2025
5510ac2
try config
DaughterOfMars Mar 5, 2025
d3d7334
try moving it?
DaughterOfMars Mar 5, 2025
ff119d0
last thing
DaughterOfMars Mar 5, 2025
87f1a8d
remove the v
DaughterOfMars Mar 5, 2025
6dc165a
uncomment
DaughterOfMars Mar 5, 2025
79d99bd
cleanup
DaughterOfMars Mar 5, 2025
efc9edf
revert commented condition
DaughterOfMars Mar 6, 2025
4931c4f
Update .github/workflows/release.yml
DaughterOfMars Mar 10, 2025
99974ab
remove versionless_tag
DaughterOfMars Mar 11, 2025
9e115d9
remove artifact_name
DaughterOfMars Mar 11, 2025
455fc2d
Merge branch 'develop' into dev-tools/update-homebrew
thibault-martinez Mar 17, 2025
bdcf3cb
update comment
DaughterOfMars Mar 17, 2025
1279e17
Merge branch 'dev-tools/update-homebrew' of https://github.com/iotale…
DaughterOfMars Mar 17, 2025
f92aa4b
clean up
DaughterOfMars Mar 17, 2025
ef65dd2
fix comment
DaughterOfMars Mar 17, 2025
6d17f0e
use release page instead of workflow run
DaughterOfMars Mar 17, 2025
98134ca
Update scripts/homebrew/update_formula.sh
DaughterOfMars Mar 17, 2025
48b732d
review
DaughterOfMars Mar 17, 2025
90c2996
Merge branch 'dev-tools/update-homebrew' of https://github.com/iotale…
DaughterOfMars Mar 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 31 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,34 @@ jobs:
files: |
./tmp/${{ env.artifact_name }}.tgz

# update-homebrew-formula:
# name: Run brew bump-formula-pr for iota on testnet releases
# needs: release-build
# runs-on: ubuntu-latest
# # releasing iota cli on testnet releases because it lags `main` less than mainnet, but is more likely to be stable than devnet
# if: ${{ github.event_name == 'release' && contains( inputs.iota_ref, '-rc') }}
# steps:
# - uses: mislav/bump-homebrew-formula-action@b3327118b2153c82da63fd9cbf58942146ee99f0 # v3.1.0
# with:
# formula-name: iota
# create-pullrequest: true
# tag-name: "${{ env.iota_ref }}"
# commit-message: |
# {{formulaName}} ${{ env.iota_ref }}
#
# Created by https://github.com/mislav/bump-homebrew-formula-action
#
# From release: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
# env:
# # https://github.com/settings/tokens/new?scopes=public_repo,workflow
# COMMITTER_TOKEN: ${{ secrets.HOMEBREW_GH_FORMULA_BUMP }}
update-homebrew-formula:
name: Update the homebrew-tap formula
needs: release-build
runs-on: ubuntu-latest
# releasing iota cli on testnet releases because it lags `develop` less than mainnet, but is more likely to be stable than devnet
if: ${{ github.event_name == 'release' && contains(github.ref, '-rc') }}
steps:
- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH
- name: Install github CLI
run: brew install gh
- name: Get tag for the release
shell: bash
run: |
echo iota_tag="$(echo ${{ github.ref }} | sed s/'refs\/tags\/'//)" >> $GITHUB_ENV
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Get binary checksums
uses: thewh1teagle/checksum@95253f85718318e3df2632d2de33030fa5fe4cb9 # v1.0.0
with:
tag: ${{ env.iota_tag }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/homebrew/update_formula.sh ${{ env.iota_tag }}
env:
# GH_TOKEN needs write access to the repository specified by the homebrew-tap input,
# or enough privileges to fork the tap repo (usually homebrew-core) and submit a PR to it.
# Recommended "classic" token scopes: repo & workflow.
# https://github.com/settings/tokens/new?scopes=public_repo,workflow
GH_TOKEN: ${{ secrets.HOMEBREW_GH_FORMULA_BUMP }}
3 changes: 3 additions & 0 deletions scripts/homebrew/pr_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Description

A new release has been published on {{server_url}}/{{repository}}: [`{{repository}} {{tag}}`]({{server_url}}/{{repository}}/releases/tag/{{tag}})
49 changes: 49 additions & 0 deletions scripts/homebrew/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class Iota < Formula
desc "Bringing the real world to Web3 with a scalable, decentralized and programmable DLT infrastructure"
homepage "https://www.iota.org"
license "Apache-2.0"

version "{{version}}"
checksums = {
"macos-arm64" => "{{macos-arm64-checksum}}",
"linux-x86_64" => "{{linux-x86_64-checksum}}"
}
arch = ""

on_macos do
on_arm do
arch = "macos-arm64"
end
end

on_linux do
on_intel do
arch = "linux-x86_64"
end
end

# Return with error if no compatible architecture was found.
odie "Unsupported architecture #{Hardware::CPU.arch.to_s}-#{OS.kernel_name}. Please use cargo install and build from source" if arch == ""

url "https://github.com/iotaledger/iota/releases/download/v#{version}/iota-v#{version}-#{arch}.tgz"
sha256 checksums[arch]

def install
bin.install "iota" => "iota"
bin.install "iota-tool" => "iota-tool"
end

# TODO if arch is empty, build from source

test do
assert_match version.to_s, shell_output("#{bin}/iota --version")

(testpath/"test.keystore").write <<~EOS
[
"iotaprivkey1qrg9875hq63wqnya0hy3khlkfjvarp009chky42uu2gu9c2dsv32qk8r7ae"
]
EOS
keystore_output = shell_output("#{bin}/iota keytool --keystore-path test.keystore list")
assert_match "0x7f21a048ec0e1d82d2e4a89a3b304e12813cafce1e8410f7a8d3be33c214c422", keystore_output
end
end
51 changes: 51 additions & 0 deletions scripts/homebrew/update_formula.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

ROOT=$(git rev-parse --show-toplevel || realpath "$(dirname "$0")/../..")

tag=$1
org=${2:-"iotaledger"}
repository=${3:-"iota"}

if [ -z "$GH_TOKEN" ]; then
echo "Environment variable GH_TOKEN must be set!"
exit 1
fi

# Remove leading `v` from tag
version=$(echo "${tag}" | sed -En "s|v?(.+)|\1|p")
server_url="https://github.com/${org}"
auth_url="https://${GH_TOKEN}@github.com/${org}"

checksums=${ROOT}/checksum.txt

macos_arm64_checksum=$(sed -En 's/^.*macos-arm64.*([0-9a-f]{64})$/\1/p' "${checksums}")
linux_x86_64_checksum=$(sed -En 's/^.*linux-x86_64.*([0-9a-f]{64})$/\1/p' "${checksums}")

git clone "${auth_url}"/homebrew-tap homebrew-tap
cd homebrew-tap || exit
git checkout -b "${repository}"-"${tag}"

formula="Formula/${repository}.rb"
pr_template=$(cat "${ROOT}"/scripts/homebrew/pr_template.md)

pr_description=$(echo "${pr_template}" | \
sed "s|{{server_url}}|${server_url}|g" | \
sed "s|{{repository}}|${repository}|g" | \
sed "s|{{tag}}|${tag}|g")

cp -rf "${ROOT}"/scripts/homebrew/template "${formula}"

sed -i -e "s|{{version}}|${version}|g" "${formula}"
sed -i -e "s|{{macos-arm64-checksum}}|${macos_arm64_checksum}|g" "${formula}"
sed -i -e "s|{{linux-x86_64-checksum}}|${linux_x86_64_checksum}|g" "${formula}"

title="Update brew formula for ${repository} ${tag}"

git config user.name "IOTA Foundation"
git config user.email "[email protected]"

git add "${formula}"
git commit -m "${title}"
git push --set-upstream origin "${repository}"-"${tag}"

gh pr create --base main --title "${title}" --body "${pr_description}"