uses : to set env var for Windows #58
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Github release for the repo | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
cargo_build: | |
name: Cargo build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
#- target: x86_64-apple-darwin | |
# asset_name: x86_64-apple | |
# os: macos-latest | |
#- target: aarch64-apple-darwin | |
# asset_name: aarch64-apple | |
# os: macos-latest | |
# - target: x86_64-unknown-linux-musl | |
# asset_name: x86_64-linux | |
# os: ubuntu-20.04 | |
# container: quay.io/tembo/muslrust:1.71.0-stable | |
#- target: aarch64-unknown-linux-musl | |
# asset_name: aarch64-linux | |
# os: ubuntu-20.04 | |
# container: messense/rust-musl-cross:aarch64-musl | |
- target: x86_64-pc-windows-msvc | |
asset_name: x86_64-windows | |
os: windows-latest | |
runs-on: ${{ matrix.os }} | |
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: Install Deps Windows | |
id: install_deps_windows | |
run: | | |
vcpkg integrate install | |
set OPENSSL_DIR="C:/vcpkg/packages/openssl_x64-windows" | |
if: runner.os == 'Windows' | |
- 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 tembo.exe | |
git config --global --add safe.directory '*' | |
# 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 | |
TEMBO_CLI_NAME=$(cargo-get package.name)-$(cargo-get package.version) | |
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $GITHUB_ENV | |
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" | |
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $env:$GITHUB_ENV | |
if: runner.os == 'Windows' | |
- name: "Generate release changelog" | |
id: changelog | |
uses: mikepenz/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- 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 | |
tag: ${{ github.ref }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
prerelease: true | |