2022-12-18 20:05:49 +01:00
|
|
|
name: release
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- next
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
name: ${{ matrix.target }}
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-musl
|
2022-12-18 21:27:21 +01:00
|
|
|
release-target: linux-amd64
|
2022-12-18 20:05:49 +01:00
|
|
|
deb: true
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: arm-unknown-linux-musleabihf
|
2022-12-18 21:27:21 +01:00
|
|
|
release-target: linux-arm
|
2022-12-18 20:05:49 +01:00
|
|
|
- os: ubuntu-latest
|
|
|
|
target: armv7-unknown-linux-musleabihf
|
2022-12-18 21:27:21 +01:00
|
|
|
release-target: linux-arm7
|
2022-12-18 20:05:49 +01:00
|
|
|
- os: ubuntu-latest
|
|
|
|
target: aarch64-unknown-linux-musl
|
2022-12-18 21:27:21 +01:00
|
|
|
release-target: linux-arm64
|
2022-12-18 20:05:49 +01:00
|
|
|
deb: true
|
|
|
|
|
|
|
|
- os: macos-11
|
|
|
|
target: x86_64-apple-darwin
|
2022-12-18 21:27:21 +01:00
|
|
|
release-target: darwin-amd64
|
2022-12-18 20:05:49 +01:00
|
|
|
- os: macos-11
|
|
|
|
target: aarch64-apple-darwin
|
2022-12-18 21:27:21 +01:00
|
|
|
release-target: darwin-arm64
|
2022-12-18 20:05:49 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Get version
|
|
|
|
id: get_version
|
|
|
|
run: sed -En 's/^version = "(.*)"/value=\1/p' Cargo.toml >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Setup cache
|
|
|
|
uses: Swatinem/rust-cache@v1
|
|
|
|
with:
|
|
|
|
key: ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Build binary
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release --locked --target=${{ matrix.target }} --color=always --verbose
|
|
|
|
use-cross: ${{ runner.os == 'Linux' }}
|
|
|
|
|
|
|
|
- name: Install cargo-deb
|
|
|
|
if: ${{ matrix.deb == true }}
|
|
|
|
uses: actions-rs/install@v0.1
|
|
|
|
with:
|
|
|
|
crate: cargo-deb
|
|
|
|
|
|
|
|
- name: Build deb
|
|
|
|
if: ${{ matrix.deb == true }}
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: deb
|
|
|
|
args: --no-build --no-strip --output=. --target=${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Package (*nix)
|
|
|
|
if: runner.os != 'Windows'
|
|
|
|
run: >
|
|
|
|
tar -cv
|
|
|
|
LICENSE README.md
|
|
|
|
man/
|
|
|
|
-C target/${{ matrix.target }}/release/ toolkit
|
|
|
|
| gzip --best
|
2022-12-18 21:27:21 +01:00
|
|
|
> 'toolkit-${{ steps.get_version.outputs.value }}-${{ matrix.release-target }}.tar.gz'
|
2022-12-18 20:05:49 +01:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2022-12-18 21:27:21 +01:00
|
|
|
name: ${{ matrix.release-target }}
|
2022-12-18 20:05:49 +01:00
|
|
|
path: |
|
|
|
|
*.deb
|
|
|
|
*.tar.gz
|
|
|
|
*.zip
|
|
|
|
- name: Create release
|
|
|
|
if: ${{ github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'chore(release)') }}
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
draft: true
|
|
|
|
files: |
|
|
|
|
*.deb
|
|
|
|
*.tar.gz
|
|
|
|
*.zip
|
2022-12-18 23:01:43 +01:00
|
|
|
name: v${{ steps.get_version.outputs.value }}
|
2022-12-18 22:28:04 +01:00
|
|
|
tag_name: v${{ steps.get_version.outputs.value }}
|