Skip to content

Prepare release (#119) #8

Prepare release (#119)

Prepare release (#119) #8

Workflow file for this run

name: Release
on:
push:
tags: [ "v*" ]
workflow_dispatch: {}
defaults:
run:
shell: bash
jobs:
release:
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
name: Release ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- name: Determine release type
id: release-type
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo 'type=release' >> "$GITHUB_OUTPUT"
else
echo 'type=prerelease' >> "$GITHUB_OUTPUT"
fi
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-release-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ runner.os }}-release-cargo
- name: Build CLI app
run: |
cargo build -p term-transcript-cli \
--profile=executable \
--target=${{ matrix.target }} \
--all-features \
--locked
- name: Package archive
id: package
run: ./cli/package.sh ${REF#refs/*/}
env:
OS: ${{ matrix.os }}
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
- name: Publish archive
uses: softprops/action-gh-release@v1
if: github.event_name == 'push'
with:
draft: false
files: ${{ steps.package.outputs.archive }}
prerelease: ${{ steps.release-type.outputs.type == 'prerelease' }}
- name: Attach archive to workflow
uses: actions/upload-artifact@v4
if: github.event_name == 'workflow_dispatch'
with:
name: term-transcript-${{ matrix.target }}
path: ${{ steps.package.outputs.archive }}