(cargo-release) version 0.9.3 #24
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: Publish | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
publish: | |
name: Publish for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
artifact_name: crabz | |
asset_name: crabz-linux-amd64 | |
- os: macos-latest | |
artifact_name: crabz | |
asset_name: crabz-macos-amd64 | |
- os: windows-latest | |
artifact_name: crabz.exe | |
asset_name: crabz-windows-amd64.exe | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build | |
shell: bash | |
run: | | |
cargo build --release --locked | |
- name: Build archive | |
shell: bash | |
run: | | |
staging="${{matrix.asset_name}}-src" | |
mkdir -p "$staging" | |
cp {README.md,UNLICENSE,LICENSE-MIT} "$staging/" | |
cp {Cargo.toml,Cargo.lock} "$staging/" | |
cp -R ./src "./$staging/src" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
7z a "${staging}.zip" "$staging" | |
echo "ASSET=${staging}.zip" >> $GITHUB_ENV | |
else | |
tar czf "${staging}.tar.gz" "${staging}" | |
echo "ASSET=${staging}.tar.gz" >> $GITHUB_ENV | |
fi | |
- name: Create deb artifact | |
shell: bash | |
run: | | |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
cargo install --locked cargo-deb | |
asset_path="${{ matrix.asset_name }}.deb" | |
cargo deb --output ./"${asset_path}" | |
echo "DEB=${asset_path}" >> $GITHUB_ENV | |
fi | |
- name: Upload deb package | |
uses: svenstaro/upload-release-action@v2 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.DEB }} | |
asset_name: ${{ env.DEB }} | |
tag: ${{ github.ref }} | |
- name: Upload src to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.ASSET }} | |
asset_name: ${{ env.ASSET }} | |
tag: ${{ github.ref }} | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/release/${{ matrix.artifact_name }} | |
asset_name: ${{ matrix.asset_name }} | |
tag: ${{ github.ref }} |