Build, Upload, and Create GitHub Release #18
Workflow file for this run
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: Build, Upload, and Create GitHub Release | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
jobs: | ||
build-and-release: | ||
Check failure on line 9 in .github/workflows/release.yaml GitHub Actions / Build, Upload, and Create GitHub ReleaseInvalid workflow file
|
||
name: Build and upload | ||
runs-on: ${{ matrix.os }} | ||
needs: test | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-22.04 | ||
target: x86_64-unknown-linux-musl | ||
- os: macos-latest | ||
target: x86_64-apple-darwin | ||
- os: macos-latest | ||
target: aarch64-apple-darwin | ||
# - os: windows-latest | ||
# target: x86_64-pc-windows-gnu | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Get the release version from the tag | ||
shell: bash | ||
run: echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
- run: cargo test | ||
- name: Build the project | ||
run: cargo build --release --target ${{ matrix.target }} | ||
- name: Build archive | ||
shell: bash | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
binary_name="checksum" | ||
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | ||
mkdir "$dirname" | ||
# TODO: Resolve issues with windows builds failing | ||
# if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
# mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" | ||
# 7z a "$dirname.zip" "$dirname" | ||
# echo "ASSET=$dirname.zip" >> $GITHUB_ENV | ||
# else | ||
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" | ||
tar -czf "$dirname.tar.gz" "$dirname" | ||
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | ||
# fi | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: | | ||
${{ env.ASSET }} |