name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-20.04]
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Create release archive
run: |
mkdir -p release
cp target/${{ matrix.target }}/release/rust-cache release/
cp target/${{ matrix.target }}/release/rust-cache-cli release/
cp rust-cache.toml release/
cp rust-cache.service.example release/
tar czf rust-cache-${{ matrix.target }}.tar.gz -C release .
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: rust-cache-${{ matrix.target }}
path: rust-cache-${{ matrix.target }}.tar.gz
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
rust-cache-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}