chore: Release #33
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: Continuous Delivery | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- "v*" | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-release: | |
name: Build release and upload assets | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: linux | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- build: macos | |
os: macos-latest | |
target: aarch64-apple-darwin | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Get the release version from the tag | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: wasm32-wasi | |
components: rustfmt, clippy | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2.2.1 | |
- name: Release build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Build archive | |
shell: bash | |
run: | | |
# Replace with the name of your binary | |
binary_name="cli" | |
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | |
mkdir "$dirname" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" | |
else | |
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" | |
fi | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
7z a "$dirname.zip" "$dirname" | |
shasum -a 256 "$dirname.tar.gz" > "$dirname.tar.gz.sha256" | |
echo "ASSET=$dirname.zip" >> $GITHUB_ENV | |
echo "ASSET_SUM=$dirname.tar.gz.sha256" >> $GITHUB_ENV | |
else | |
tar -czf "$dirname.tar.gz" "$dirname" | |
shasum -a 256 "$dirname.tar.gz" > "$dirname.tar.gz.sha256" | |
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | |
echo "ASSET_SUM=$dirname.tar.gz.sha256" >> $GITHUB_ENV | |
fi | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
needs: [ 'build-release' ] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: CHANGELOG.md | |
files: | | |
${{ env.ASSET }} | |
${{ env.ASSET_SUM }} | |