Skip to content

Add releases

Add releases #8

Workflow file for this run

name: Rust Multi-Arch Build
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: Test for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
- target: armv7-unknown-linux-gnueabihf
- target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install cross
run: cargo install cross
- name: Test binary
run: cross test --target ${{ matrix.target }}
build:
name: Build for ${{ matrix.target }}
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
- target: armv7-unknown-linux-gnueabihf
- target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install cross
run: cargo install cross
- name: Build binary
run: cross build --target ${{ matrix.target }} --release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/
release:
name: Release
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v2
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/
- name: Set env
run: |
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.BRANCH }}-${{ matrix.target }}
body: |
Changes in this Release
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/${{ matrix.target }}/release/
asset_name: image_cleaner-${{ matrix.target }}
asset_content_type: application/octet-stream