Release Analytics CLI #81
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: 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: | |
include: | |
- target: x86_64-unknown-linux-musl | |
artifact-name: x86_64-unknown-linux | |
runs-on: public-amd64-2xlarge | |
- target: aarch64-unknown-linux-musl | |
artifact-name: aarch64-unknown-linux | |
runs-on: public-arm64-2xlarge | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Rust & Cargo | |
uses: ./.github/actions/setup_rust_cargo | |
if: "!cancelled()" | |
- name: Update version | |
uses: ./.github/actions/update_version | |
if: "!cancelled()" | |
with: | |
version: ${{ github.event.inputs.release_tag }} | |
- name: Build ${{ matrix.target }} target | |
uses: ./.github/actions/build_cli_linux_target | |
if: "!cancelled()" | |
with: | |
target: ${{ matrix.target }} | |
profile: release-with-debug | |
- name: Upload debug info to Sentry | |
uses: ./.github/actions/upload_sentry_debug_info | |
if: "!cancelled()" | |
with: | |
target: ${{ matrix.target }} | |
sentry-org: ${{ secrets.SENTRY_ORG }} | |
sentry-project: ${{ secrets.SENTRY_PROJECT }} | |
sentry-auth-token: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
if: "!cancelled()" | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli | |
if-no-files-found: error | |
build_macos: | |
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: Setup Rust & Cargo | |
uses: ./.github/actions/setup_rust_cargo | |
if: "!cancelled()" | |
- name: Update version | |
uses: ./.github/actions/update_version | |
if: "!cancelled()" | |
with: | |
version: ${{ github.event.inputs.release_tag }} | |
- name: Build ${{ matrix.target }} target | |
uses: ./.github/actions/build_cli_macos_target | |
if: "!cancelled()" | |
with: | |
target: ${{ matrix.target }} | |
profile: release-with-debug | |
- name: Upload debug info to Sentry | |
uses: ./.github/actions/upload_sentry_debug_info | |
if: "!cancelled()" | |
with: | |
target: ${{ matrix.target }} | |
sentry-org: ${{ secrets.SENTRY_ORG }} | |
sentry-project: ${{ secrets.SENTRY_PROJECT }} | |
sentry-auth-token: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
if: "!cancelled()" | |
with: | |
name: ${{ matrix.target }} | |
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli | |
if-no-files-found: error | |
tag_and_release: | |
name: Tag and Release [ ${{ github.event.inputs.release_tag }} ] | |
runs-on: public-amd64-small | |
needs: [build_linux, build_macos] | |
steps: | |
- uses: actions/checkout@v4 | |
- id: download | |
uses: actions/download-artifact@v4 | |
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-${target}.tar.gz \ | |
-C build/${target} trunk-analytics-cli | |
done | |
- name: Install gh | |
uses: trunk-io/trunk-action/install@v1 | |
with: | |
tools: gh | |
- name: Create GH release and upload binary | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create --prerelease --latest=false \ | |
--target ${{ github.ref }} \ | |
--generate-notes ${{ github.event.inputs.release_tag }} \ | |
./build/*.tar.gz | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
version: ${{ github.event.inputs.release_tag }} |