Release #5
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 | ||
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@v3 | ||
- 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@v3 | ||
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/tags/"} | ||
env: | ||
OS: ${{ matrix.os }} | ||
TARGET: ${{ matrix.target }} | ||
REF: ${{ github.ref }} | ||
- name: Publish archive | ||
uses: softprops/action-gh-release@v1 | ||
if: github.event_name == "push" | ||
Check failure on line 72 in .github/workflows/release.yml GitHub Actions / ReleaseInvalid workflow file
|
||
with: | ||
draft: false | ||
files: ${{ steps.package.outputs.archive }} | ||
prerelease: ${{ steps.release-type.outputs.type == 'prerelease' }} | ||
- name: Attach archive to action | ||
uses: actions/upload-artifact@v3 | ||
if: github.event_name == "workflow_dispatch" | ||
with: | ||
name: term-transcript-${{ matrix.target }} | ||
path: ${{ steps.package.outputs.archive }} |