Skip to content

Update to trane v0.27.0 (#106) #116

Update to trane v0.27.0 (#106)

Update to trane v0.27.0 (#106) #116

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
env:
BIN_NAME: trane
PROJECT_NAME: trane-cli
REPO_NAME: trane-project/trane-cli
jobs:
dist:
name: Dist
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't fail other jobs if one fails
matrix:
build: [x86_64-linux, aarch64-linux, x86_64-apple, aarch64-apple, x86_64-windows]
include:
- build: x86_64-linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
cargo_cmd: cargo
- build: aarch64-linux
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
cargo_cmd: cross
- build: x86_64-apple
os: macos-15-intel
rust: stable
target: x86_64-apple-darwin
cargo_cmd: cargo
- build: aarch64-apple
os: macos-latest
rust: stable
target: aarch64-apple-darwin
cargo_cmd: cargo
- build: x86_64-windows
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
cargo_cmd: cargo
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: true
- name: Install ${{ matrix.rust }} toolchain
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install cross
run: cargo install --version 0.1.16 cross
- name: Build release binary
run: ${{ matrix.cargo_cmd }} build --release --locked --target ${{ matrix.target }}
- name: Build upload directory
shell: bash
run: |
mkdir dist
if [[ "${{ matrix.os }}" == *windows* ]]; then
cp "target/${{ matrix.target }}/release/$BIN_NAME.exe" "dist/"
else
cp "target/${{ matrix.target }}/release/$BIN_NAME" "dist/"
fi
- uses: actions/upload-artifact@v4.6.2
with:
name: bins-${{ matrix.build }}
path: dist
publish:
name: Publish
needs: [dist]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: false
- uses: actions/download-artifact@v4.2.1
- run: ls -al bins-*
- name: Calculate tag name
run: |
name=dev
if [[ $GITHUB_REF == refs/tags/v* ]]; then
name=${GITHUB_REF:10}
fi
echo ::set-output name=val::$name
echo TAG=$name >> $GITHUB_ENV
id: tagname
- name: Build archive
shell: bash
run: |
set -ex
rm -rf tmp
mkdir tmp
mkdir dist
for dir in bins-* ; do
platform=${dir#"bins-"}
unset exe
if [[ $platform =~ "windows" ]]; then
exe=".exe"
fi
pkgname=$PROJECT_NAME-$TAG-$platform
mkdir tmp/$pkgname
# cp LICENSE README.md tmp/$pkgname
mv bins-$platform/$BIN_NAME$exe tmp/$pkgname
chmod +x tmp/$pkgname/$BIN_NAME$exe
if [ "$exe" = "" ]; then
tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
else
(cd tmp && 7z a -r ../dist/$pkgname.zip $pkgname)
fi
done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@2.5.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ steps.tagname.outputs.val }}
overwrite: true
- name: Extract version
id: extract-version
run: |
printf "::set-output name=%s::%s\n" tag-name "${GITHUB_REF#refs/tags/}"