Update Cargo.toml #26
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: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
BIN_NAME: silk-cli | |
jobs: | |
compile: | |
name: Compile | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# Linux | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
rid: linux-x64 | |
postfix: "" | |
# Windows | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
rid: win-x64 | |
postfix: ".exe" | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
rid: win-arm64 | |
postfix: ".exe" | |
# Mac OSX | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
rid: osx-x64 | |
postfix: "" | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
rid: osx-arm64 | |
postfix: "" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get tag | |
id: tag | |
uses: devops-actions/[email protected] | |
with: | |
default: ${{ github.run_id }} | |
- name: Install dependencies (Ubuntu only) | |
if: startsWith(matrix.os, 'ubuntu-') | |
run: | | |
sudo apt update | |
sudo apt install -y musl-tools | |
- name: Build executable | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo build --release --target ${{ matrix.target }} | |
- name: Pack binary (Ubuntu and macOS) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release/ | |
zip -r ${{ env.BIN_NAME }}-${{ matrix.rid }}-${{ steps.tag.outputs.tag }}.zip ${{ env.BIN_NAME }}${{ matrix.postfix }} | |
- name: Pack binary (Windows) | |
if: matrix.os == 'windows-latest' | |
run: Compress-Archive -CompressionLevel Optimal -Force -Path target/${{ matrix.target }}/release/${{ env.BIN_NAME }}${{ matrix.postfix }} -DestinationPath target/${{ matrix.target }}/release/${{ env.BIN_NAME }}-${{ matrix.rid }}-${{ steps.tag.outputs.tag }}.zip | |
shell: pwsh | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: compile-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/${{ env.BIN_NAME }}-${{ matrix.rid }}-${{ steps.tag.outputs.tag }}.zip | |
release: | |
name: Release | |
needs: [compile] | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Get tag | |
id: tag | |
uses: devops-actions/[email protected] | |
with: | |
default: ${{ github.run_id }} | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: compile-* | |
merge-multiple: true | |
path: ./packages | |
- name: Github release | |
uses: "softprops/action-gh-release@v2" | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
with: | |
files: | | |
./packages/${{ env.BIN_NAME }}-linux-x64-${{ steps.tag.outputs.tag }}.zip | |
./packages/${{ env.BIN_NAME }}-win-x64-${{ steps.tag.outputs.tag }}.zip | |
./packages/${{ env.BIN_NAME }}-win-arm64-${{ steps.tag.outputs.tag }}.zip | |
./packages/${{ env.BIN_NAME }}-osx-x64-${{ steps.tag.outputs.tag }}.zip | |
./packages/${{ env.BIN_NAME }}-osx-arm64-${{ steps.tag.outputs.tag }}.zip |