Skip to content

test trigger

test trigger #91

Workflow file for this run

name: Github release for the repo
permissions:
contents: write
on:
push:
branches:
- bump-homebrew-formula
paths:
- 'tembo-cli/Cargo.toml'
jobs:
gh_release:
name: Github Release
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
asset_name: x86_64-apple
os: macos-latest
executable: tembo
- target: aarch64-apple-darwin
asset_name: aarch64-apple
os: macos-latest
executable: tembo
- target: x86_64-unknown-linux-musl
asset_name: x86_64-linux
os: ubuntu-20.04
container: quay.io/tembo/muslrust:1.76.0-stable
executable: tembo
- target: aarch64-unknown-linux-musl
asset_name: aarch64-linux
os: ubuntu-20.04
container: messense/rust-musl-cross:aarch64-musl
executable: tembo
- target: x86_64-pc-windows-msvc
asset_name: x86_64-windows
os: windows-latest
executable: tembo.exe
runs-on: ${{ matrix.os }}
outputs:
version: ${{ steps.cli_version_mac.outputs.version }}
release_version: ${{ steps.set_release_version.outputs.release_version }}
sha_x86_64: ${{ steps.fetch_sha256.outputs.sha_x86_64 }}
sha_aarch64: ${{ steps.fetch_sha256.outputs.sha_aarch64 }}
container:
image: ${{ matrix.container }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Install Deps Ubuntu
id: install_deps_ubuntu
run: |
set -x
apt update -y
apt install pkg-config libssl-dev -y
if: runner.os == 'Linux'
- name: Cargo build
working-directory: ./tembo-cli
id: cargo_build
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target=${{ matrix.target }}
cd target/${{ matrix.target }}/release
tar -czvf tembo.tar.gz ${{ matrix.executable }}
git config --global --add safe.directory '*'
- name: Fetch sha256
working-directory: ./tembo-cli
id: fetch_sha256
run: |
sha_256=$(shasum -a 256 tembo-cli/target/${{ matrix.target }}/release/tembo.tar.gz | cut -d" " -f 1)
if [[ ${{ matrix.target }} == "x86_64-apple-darwin" ]]
then
echo "sha_x86_64=$sha_256" >> $GITHUB_OUTPUT
elif [[ ${{ matrix.target }} == "aarch64-apple-darwin" ]]
echo "sha_aarch64=$sha_256" >> $GITHUB_OUTPUT
fi
if: runner.os == 'macOS'
# TODO: Figure out a better way to fetch version for mac & linux
- name: CLI version Mac
working-directory: ./tembo-cli
id: cli_version_mac
run: |
cargo install cargo-get
VERSION=$(cargo-get package.version)
TEMBO_CLI_NAME=$(cargo-get package.name)-$VERSION
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
if: runner.os == 'macOS'
- name: CLI version Linux
working-directory: ./tembo-cli
id: cli_version_linux
run: |
set -x
PKG_VERSION=$(awk -F ' = ' '$$1 ~ /version/ { gsub(/[\\"]/, "", $$2); printf("%s",$$2); exit; }' Cargo.toml)
TEMBO_VERSION=${PKG_VERSION#"version = "}
TEMBO_CLI_NAME=tembo-cli-${TEMBO_VERSION}
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $GITHUB_ENV
if: runner.os == 'Linux'
- name: CLI version Windows
working-directory: ./tembo-cli
id: cli_version_windows
run: |
$TEMBO_VERSION = $(target/${{ matrix.target }}/release/tembo.exe --version)
$TEMBO_CLI_NAME = $TEMBO_VERSION.replace(' ','-')
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
- name: "Generate release changelog"
id: changelog
uses: mikepenz/release-changelog-builder-action@v4.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: set env non-windows
id: set_release_version
run: |
RELEASE_VERSION=$(date +'%Y.%m.%d')
echo "NOW=$RELEASE_VERSION" >> $GITHUB_ENV
echo "release_version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
if: runner.os != 'Windows'
- name: set env windows
run: echo "NOW=$(date +'%Y.%m.%d')" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tembo-cli/target/${{ matrix.target }}/release/tembo.tar.gz
asset_name: ${{ env.TEMBO_CLI_NAME }}-${{ matrix.asset_name }}.tar.gz
prerelease: true
tag: ${{ env.NOW }}
body: ${{ steps.changelog.outputs.changelog }}
post_gh_release:
runs-on: macos-latest
needs: gh_release
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
repository: tembo-io/homebrew-tembo
ssh-key: ${{ secrets.SERVICE_USER_GITHUB_SSH_KEY }}
path: homebrew-tembo
- name: Git commit and push to remote
shell: bash
run: |
set -xe
cd homebrew-tembo
git config --global user.name "coredb-service-user"
git config --global user.email "admin+github@coredb.io"
git fetch origin test-bump && git checkout test-bump || git checkout -b test-bump
- name: Replace version
shell: bash
run: |
set -xe
cd homebrew-tembo
sed -E -i '' 's/version ".*/version "${{needs.gh_release.outputs.version}}"/g' tembo-cli.rb
- name: Replace release_version
shell: bash
run: |
set -xe
cd homebrew-tembo
sed -E -i '' 's/release_version =.*/release_version = "${{needs.gh_release.outputs.release_version}}"/g' tembo-cli.rb
- name: Replace sha_x86_64
shell: bash
run: |
set -xe
cd homebrew-tembo
sed -E -i '' 's/sha256.*/sha256 "${{needs.gh_release.outputs.sha_x86_64}}"/g' tembo-cli.rb
- name: Replace sha_aarch_64
shell: bash
run: |
set -xe
cd homebrew-tembo
sed -E -i '' '1,/sha256.*/ s/sha256.*/sha256 "${{needs.gh_release.outputs.sha_aarch_64}}"/g' tembo-cli.rb
- name: Git commit and push to remote
shell: bash
run: |
set -xe
cd homebrew-tembo
git add --all
# debugging
git diff HEAD
git commit -m "Update from tembo-io/tembo: ${{ inputs.version }}"
git push origin test-bump