Skip to content

feat(alias): add alias command to set up shell integration (#47) #21

feat(alias): add alias command to set up shell integration (#47)

feat(alias): add alias command to set up shell integration (#47) #21

Workflow file for this run

name: Build release
permissions:
contents: write
pull-requests: write
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
bump-version:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version in Cargo.toml and Cargo.lock
run: |
VERSION="${GITHUB_REF_NAME#v}"
sed -i "s/^version = \"[^\"]*\"/version = \"${VERSION}\"/" crates/cli/Cargo.toml
cargo update -p edgee-cli
- name: Open PR with version bump
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
BRANCH="chore/bump-version-to-${VERSION}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add crates/cli/Cargo.toml Cargo.lock
git diff --staged --quiet && echo "Version already up to date, skipping PR." && exit 0
git commit -m "Bump version to ${VERSION}"
git push origin "$BRANCH"
gh pr create \
--title "Bump version to ${VERSION}" \
--body "Automated version bump triggered by release tag \`${GITHUB_REF_NAME}\`." \
--base main \
--head "$BRANCH"
build-release-binaries:
needs: bump-version
strategy:
matrix:
platform:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
rustflags: -C target-feature=+crt-static
bin_suffix: .exe
name: Build release binary (${{ matrix.platform.target }} on ${{ matrix.platform.os }})
runs-on: ${{ matrix.platform.os }}
env:
RUSTFLAGS: ${{ matrix.platform.rustflags || '' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set version from tag
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
sed -i.bak "s/^version = \"[^\"]*\"/version = \"${VERSION}\"/" crates/cli/Cargo.toml
rm -f Cargo.toml.bak
- name: Build binary
uses: houseabsolute/actions-rust-cross@v1
with:
command: build
target: ${{ matrix.platform.target }}
args: "-p edgee-cli --bin edgee --release"
- name: Save binary
uses: actions/upload-artifact@v4
with:
name: edgee.${{ matrix.platform.target }}${{ matrix.platform.bin_suffix || '' }}
path: target/${{ matrix.platform.target }}/release/edgee${{ matrix.platform.bin_suffix || '' }}
retention-days: 3
- name: Prepare release files
shell: bash
run: |
BIN="edgee.${{ matrix.platform.target }}${{ matrix.platform.bin_suffix || '' }}"
cp "target/${{ matrix.platform.target }}/release/edgee${{ matrix.platform.bin_suffix || '' }}" "$BIN"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$BIN" | awk '{print $1}' > "$BIN.sha256"
else
shasum -a 256 "$BIN" | awk '{print $1}' > "$BIN.sha256"
fi
- name: Publish artifacts and release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "edgee.${{ matrix.platform.target }}${{ matrix.platform.bin_suffix || '' }};edgee.${{ matrix.platform.target }}${{ matrix.platform.bin_suffix || '' }}.sha256"
tags: true
update-homebrew-tap:
needs: build-release-binaries
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout tap
uses: actions/checkout@v4
with:
repository: edgee-ai/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: homebrew-tap
- name: Download checksums
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for platform in aarch64-apple-darwin x86_64-apple-darwin aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu; do
gh release download "${GITHUB_REF_NAME}" \
--repo "${{ github.repository }}" \
--pattern "edgee.${platform}.sha256" \
--output "edgee.${platform}.sha256"
done
- name: Update formula
run: |
VERSION="${GITHUB_REF_NAME#v}"
SHA_AARCH64_DARWIN=$(cat edgee.aarch64-apple-darwin.sha256)
SHA_X86_64_DARWIN=$(cat edgee.x86_64-apple-darwin.sha256)
SHA_AARCH64_LINUX=$(cat edgee.aarch64-unknown-linux-gnu.sha256)
SHA_X86_64_LINUX=$(cat edgee.x86_64-unknown-linux-gnu.sha256)
FORMULA="homebrew-tap/Formula/edgee.rb"
sed -i "s/version \".*\"/version \"${VERSION}\"/" "$FORMULA"
sed -i "s/\"aarch64-apple-darwin\" => \".*\"/\"aarch64-apple-darwin\" => \"${SHA_AARCH64_DARWIN}\"/" "$FORMULA"
sed -i "s/\"x86_64-apple-darwin\" => \".*\"/\"x86_64-apple-darwin\" => \"${SHA_X86_64_DARWIN}\"/" "$FORMULA"
sed -i "s/\"aarch64-unknown-linux-gnu\" => \".*\"/\"aarch64-unknown-linux-gnu\" => \"${SHA_AARCH64_LINUX}\"/" "$FORMULA"
sed -i "s/\"x86_64-unknown-linux-gnu\" => \".*\"/\"x86_64-unknown-linux-gnu\" => \"${SHA_X86_64_LINUX}\"/" "$FORMULA"
- name: Commit and push
run: |
VERSION="${GITHUB_REF_NAME#v}"
cd homebrew-tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/edgee.rb
git commit -m "Update edgee formula to v${VERSION}"
git push