Skip to content

Release Analytics CLI #22

Release Analytics CLI

Release Analytics CLI #22

Workflow file for this run

name: Release Analytics CLI
on:
workflow_dispatch:
inputs:
release_tag:
type: string
description: Tag to create
required: True
concurrency: ${{ github.workflow }}
jobs:
build_linux:
name: Build ${{ matrix.target }}
strategy:
matrix:
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
runs-on: [ubuntu-20.04]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Update version
run: |
export VERSION=${{ github.event.inputs.release_tag }}
sed -i "s/0.0.0/$VERSION/g" Cargo.toml
- name: Build ${{ matrix.target }} target
uses: ./.github/actions/build_target
if: "!cancelled()"
with:
target: ${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/trunk-analytics-cli
build_osx:
name: Build ${{ matrix.target }}
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
runs-on: [macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
- name: Update version
run: |
export VERSION=${{ github.event.inputs.release_tag }}
sed -i '' "s/0.0.0/$VERSION/g" Cargo.toml
- name: Add target
shell: bash
run: rustup target add ${{ matrix.target }}
- name: Build ${{ matrix.target }} target
if: "!cancelled()"
run: cargo build -q --all --release --target ${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/trunk-analytics-cli
tag_and_release:
name: Tag and Release [ ${{ github.event.inputs.release_tag }} ]
runs-on: public-amd64-small
needs: [build_linux, build_osx]
steps:
- uses: actions/checkout@v4
- id: download
uses: actions/download-artifact@v3
with:
path: build
- name: Compress binaries
run: |
for target in $(ls build)
do
chmod u+x build/${target}/trunk-analytics-cli
tar czvf \
build/trunk-analytics-cli-${{ github.event.inputs.release_tag }}-${target}.tar.gz \
-C build/${target} trunk-analytics-cli
done
- name: Install Trunk
uses: trunk-io/trunk-action/install@54ccfcf9add644a36a5aa1d0046c92f654ff9e45
- name: Create GH release and upload binary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --target ${{ github.ref }} --generate-notes \
${{ github.event.inputs.release_tag }} ./build/*.tar.gz