Skip to content

chore: Increment minor version of binary #7

chore: Increment minor version of binary

chore: Increment minor version of binary #7

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
BINARY_NAME: eip712
CARGO_TERM_COLOR: always
jobs:
build:
name: Build - ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
ARCHIVE="eip712-cli-${VERSION}-${{ matrix.target }}.tar.gz"
cd target/${{ matrix.target }}/release
tar czf "../../../${ARCHIVE}" "${BINARY_NAME}"
cd ../../..
echo "ARCHIVE=${ARCHIVE}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: eip712-cli-${{ matrix.target }}
path: ${{ env.ARCHIVE }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum *.tar.gz > sha256sums.txt
cat sha256sums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/sha256sums.txt
update-formula:
name: Update Homebrew Formula
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout tap repository
uses: actions/checkout@v4
with:
repository: MaximFischuk/homebrew-eip712-cli
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
- name: Generate formula
env:
TAG: ${{ github.ref_name }}
run: |
VERSION="${TAG#v}"
curl -fsSL -o sha256sums.txt \
"https://github.com/MaximFischuk/eip712-cli/releases/download/${TAG}/sha256sums.txt"
SHA_DARWIN_ARM64=$(grep "aarch64-apple-darwin" sha256sums.txt | awk '{print $1}')
SHA_DARWIN_X86=$(grep "x86_64-apple-darwin" sha256sums.txt | awk '{print $1}')
SHA_LINUX_X86=$(grep "x86_64-unknown-linux-gnu" sha256sums.txt | awk '{print $1}')
SHA_LINUX_ARM64=$(grep "aarch64-unknown-linux-gnu" sha256sums.txt | awk '{print $1}')
mkdir -p Formula
cat > Formula/eip712-cli.rb <<RUBY
class Eip712Cli < Formula
desc "A command-line tool for working with EIP-712 typed data"
homepage "https://github.com/MaximFischuk/eip712-cli"
version "${VERSION}"
license "MIT"
on_macos do
if Hardware::CPU.arm?
url "https://github.com/MaximFischuk/eip712-cli/releases/download/v#{version}/eip712-cli-#{version}-aarch64-apple-darwin.tar.gz"
sha256 "${SHA_DARWIN_ARM64}"
else
url "https://github.com/MaximFischuk/eip712-cli/releases/download/v#{version}/eip712-cli-#{version}-x86_64-apple-darwin.tar.gz"
sha256 "${SHA_DARWIN_X86}"
end
end
on_linux do
if Hardware::CPU.arm?
url "https://github.com/MaximFischuk/eip712-cli/releases/download/v#{version}/eip712-cli-#{version}-aarch64-unknown-linux-gnu.tar.gz"
sha256 "${SHA_LINUX_ARM64}"
else
url "https://github.com/MaximFischuk/eip712-cli/releases/download/v#{version}/eip712-cli-#{version}-x86_64-unknown-linux-gnu.tar.gz"
sha256 "${SHA_LINUX_X86}"
end
end
def install
bin.install "eip712"
end
test do
assert_match "eip712", shell_output("#{bin}/eip712 --version")
end
end
RUBY
- name: Commit updated formula
env:
TAG: ${{ github.ref_name }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/eip712-cli.rb
git diff --cached --quiet || git commit -m "chore: update formula for ${TAG}"
git push