Skip to content

Do not use deprecated function. #8

Do not use deprecated function.

Do not use deprecated function. #8

Workflow file for this run

# Inspiration:
#
# https://github.com/sharkdp/hyperfine/blob/d449ebd7c18246b7c3f6ee19a97a4cf24e34e106/.github/workflows/CICD.yml
# https://github.com/BurntSushi/ripgrep/blob/61733f6378b62fa2dc2e7f3eff2f2e7182069ca9/.github/workflows/release.yml
# https://github.com/XAMPPRocky/tokei/blob/ae77e1945631fd9457f7d455f2f0f2f889356f58/.github/workflows/mean_bean_deploy.yml
name: Release
on:
workflow_dispatch:
push:
tags:
- "v[0-9]*"
defaults:
run:
shell: bash
env:
NAME: ${{ github.event.repository.name }}
VERSION: ${{ github.ref_name }}
# for gh release upload
permissions:
contents: write
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create --draft ${VERSION}
build:
name: ${{ matrix.target }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
# - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true }
# - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
- { target: i686-pc-windows-msvc , os: windows-2019 }
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
- { target: x86_64-apple-darwin , os: macos-12 }
- { target: aarch64-apple-darwin , os: macos-12 }
- { target: x86_64-pc-windows-gnu , os: windows-2019 }
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
env:
BUILD_CMD: cargo
steps:
- uses: actions/checkout@v3
- name: Install ARM/Linux prerequisites
if: startsWith(matrix.target, 'arm-unknown-linux-')
run: sudo apt-get -y install gcc-arm-linux-gnueabihf
- name: Install AArch64/Linux prerequisites
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Use cross as build tool
if: matrix.use-cross
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
- name: Build
run: $BUILD_CMD build --release --target=${{ matrix.target }}
- name: Determine paths
id: paths
run: |
EXE_suffix="" ; case ${{ matrix.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac
BIN_PATH="target/${{ matrix.target }}/release/${NAME}${EXE_suffix}"
PKG_NAME=${NAME}-${VERSION}-${{ matrix.target }}${EXE_suffix}
cp ${BIN_PATH} ${PKG_NAME}
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT
- name: Compress binary
if: matrix.use-cross
run: upx ${{ steps.paths.outputs.PKG_NAME }}
- name: Upload release archive
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${VERSION} ${{ steps.paths.outputs.PKG_NAME }}