Skip to content

Release

Release #4

Workflow file for this run

name: Release
on:
push:
tags:
- "v*" # Triggers the workflow on version tags like v1.0.0
jobs:
build:
name: Build and Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
extension: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
extension: ""
use-cross: true
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
extension: ""
use-cross: true
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
extension: ""
use-cross: true
- os: macos-latest
target: x86_64-apple-darwin
extension: ""
- os: macos-11
target: aarch64-apple-darwin
extension: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
extension: ".exe"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install cross
run: |
if [ "${{ matrix.use-cross }}" = "true" ]; then
cargo install cross
else
echo "This platform does not need cross"
fi
- name: Build the project
run: |
if [ "${{ matrix.use-cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }}
else
cargo build --release --target ${{ matrix.target }}
fi
shell: bash
- name: Prepare binary for release (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
mkdir release
Compress-Archive -Path target\${{ matrix.target }}\release\weaveconfig.exe -DestinationPath release\weaveconfig-${{ matrix.target }}.zip
shell: pwsh
- name: Prepare binary for release (Others)
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
mkdir -p release
zip -j release/weaveconfig-${{ matrix.target }}.zip target/${{ matrix.target }}/release/weaveconfig${{ matrix.extension }}
shell: bash
- name: Generate checksum (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
CertUtil -hashfile release\weaveconfig-${{ matrix.target }}.zip SHA256 > release\weaveconfig-${{ matrix.target }}.zip.sha256
shell: cmd
- name: Generate checksum (Others)
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
shasum -a 256 release/weaveconfig-${{ matrix.target }}.zip > release/weaveconfig-${{ matrix.target }}.zip.sha256
shell: bash
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: |
release/weaveconfig-${{ matrix.target }}.zip
release/weaveconfig-${{ matrix.target }}.zip.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}