Releasing v0.1.9 #76
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: GitHub Release | |
env: | |
ARTEFACTS_DIR: "_artefacts" | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: [ "v[0-9]+.[0-9]+.[0-9]+*" ] | |
# TODO Remove this trigger, once we have sorted out release for the various targets | |
workflow_dispatch: | |
jobs: | |
release: | |
name: Release | |
# Workflow strategy supports multiple targets on multiple runners | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
# Linux | |
# - { target: aarch64-unknown-linux-gnu , runner: ubuntu-20.04, cross: true, can_fail: false } | |
# - { target: i686-unknown-linux-gnu , runner: ubuntu-20.04, cross: true, can_fail: false } | |
- { target: x86_64-unknown-linux-gnu , runner: ubuntu-20.04, cross: true, can_fail: false } | |
# - { target: arm-unknown-linux-gnueabihf , runner: ubuntu-20.04, cross: true, can_fail: false } | |
# - { target: arm-unknown-linux-musleabihf, runner: ubuntu-20.04, cross: true, can_fail: false } | |
# - { target: i686-unknown-linux-musl , runner: ubuntu-20.04, cross: true, can_fail: false } | |
# - { target: x86_64-unknown-linux-musl , runner: ubuntu-20.04, cross: true, can_fail: false } | |
# macOS | |
- { target: x86_64-apple-darwin , runner: macos-10.15, cross: false, can_fail: false } | |
# Windows | |
# # TODO https://github.com/kafkesc/ksunami/issues/39 | |
# - { target: i686-pc-windows-msvc , runner: windows-2019, cross: false, can_fail: true, arch: i686 } | |
# - { target: x86_64-pc-windows-gnu , runner: windows-2019, cross: false, can_fail: true, arch: x86_64 } | |
# - { target: x86_64-pc-windows-msvc , runner: windows-2019, cross: false, can_fail: true, arch: x86_64 } | |
runs-on: ${{ matrix.job.runner }} | |
continue-on-error: ${{ matrix.job.can_fail }} | |
steps: | |
- name: Check-out | |
uses: actions/checkout@v4 | |
- name: Dependencies | |
shell: bash | |
run: | | |
case ${{ matrix.job.target }} in | |
arm-unknown-linux-*) sudo apt-get -y install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf ;; | |
aarch64-unknown-linux-gnu) sudo apt-get -y install gcc-aarch64-linux-gnu g++-arm-linux-gnueabihf ;; | |
esac | |
- name: Project info as env-var | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV | |
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV | |
# # TODO https://github.com/kafkesc/ksunami/issues/39 | |
# - name: Deps (Windows) | |
# if: ${{ startsWith(matrix.job.runner, 'windows') }} | |
# run: >- | |
# choco install visualstudio2019enterprise --package-parameters " | |
# --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 | |
# --add Microsoft.VisualStudio.Component.Windows10SDK | |
# --add Microsoft.VisualStudio.Component.Windows10SDK.19041 | |
# --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core | |
# --add Microsoft.VisualStudio.Component.VC.CMake.Project | |
# --add Microsoft.VisualStudio.Component.VC.CoreBuildTools | |
# --add Microsoft.VisualStudio.Component.VC.ATLMFC | |
# --add Microsoft.VisualStudio.Component.Roslyn.Compiler" | |
# ; choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' | |
# # TODO https://github.com/kafkesc/ksunami/issues/39 | |
# - name: Envs - MSVC (Windows) | |
# if: ${{ startsWith(matrix.job.runner, 'windows') }} | |
# uses: ilammy/msvc-dev-cmd@v1 | |
# with: | |
# arch: ${{ matrix.job.arch }} | |
# vsversion: 2019 | |
# # TODO https://github.com/kafkesc/ksunami/issues/39 | |
# - name: Envs - WindowsSdkVerBinPath (Windows) | |
# if: ${{ startsWith(matrix.job.runner, 'windows') }} | |
# uses: myci-actions/export-env-var-powershell@1 | |
# with: | |
# name: PATH | |
# value: $env:PATH;$env:WindowsSdkVerBinPath\x86;$env:WindowsSdkVerBinPath\x64 | |
- name: Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.job.target }} | |
profile: minimal | |
override: true | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.job.cross }} | |
command: build | |
args: --locked --release --target=${{ matrix.job.target }} | |
- name: Artefact | |
id: artefact | |
shell: bash | |
run: | | |
# Figure out if the binary has a suffix (Windows!) | |
EXE_SUFFIX="" | |
case ${{ matrix.job.target }} in | |
*-pc-windows-*) EXE_SUFFIX=".exe" ;; | |
esac; | |
# Setup paths | |
BIN_NAME="${{ env.PROJECT_NAME }}${EXE_SUFFIX}" | |
BIN_PATH="target/${{ matrix.job.target }}/release/${BIN_NAME}" | |
# Let subsequent steps know where to find the binary | |
echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_OUTPUT | |
echo "BIN_NAME=${BIN_NAME}" >> $GITHUB_OUTPUT | |
- name: Package | |
id: package | |
shell: bash | |
run: | | |
# Figure out the tarball suffix (Windows!) | |
PKG_SUFFIX=".tar.gz" | |
case ${{ matrix.job.target }} in | |
*-pc-windows-*) PKG_SUFFIX=".zip" ;; | |
esac | |
# Composing final PKG_NAME | |
PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }} | |
PKG_NAME=${PKG_BASENAME}${PKG_SUFFIX} | |
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT | |
PKG_STAGING="${{ env.ARTEFACTS_DIR }}/package" | |
ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/" | |
mkdir -p "${ARCHIVE_DIR}" | |
# Binary | |
cp "${{ steps.artefact.outputs.BIN_PATH }}" "$ARCHIVE_DIR" | |
# README, LICENSE-* and CHANGELOG files | |
cp "README.md" "LICENSE-APACHE" "LICENSE-MIT" "CHANGELOG.md" "$ARCHIVE_DIR" | |
# base compressed package | |
pushd "${PKG_STAGING}/" >/dev/null | |
case ${{ matrix.job.target }} in | |
*-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;; | |
*) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;; | |
esac; | |
popd >/dev/null | |
# Let subsequent steps know where to find the compressed package | |
echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT | |
- name: Release | |
id: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: v${{ env.PROJECT_VERSION }} | |
tag_name: v${{ env.PROJECT_VERSION }} | |
files: | | |
${{ steps.package.outputs.PKG_PATH }} |