Skip to content

docs: remove WIP label from README #62

docs: remove WIP label from README

docs: remove WIP label from README #62

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- {
OS: macos-latest,
TARGET: x86_64-apple-darwin, # 64-bit macOS (10.12+, Sierra+)
NAME: darwin-amd64,
}
- {
OS: macos-latest,
TARGET: aarch64-apple-darwin, # ARM64 macOS (11.0+, Big Sur+)
NAME: darwin-arm64,
}
- {
OS: ubuntu-latest,
TARGET: i686-unknown-linux-gnu, # 32-bit Linux (kernel 3.2+, glibc 2.17+)
NAME: linux-i686,
}
- {
OS: ubuntu-latest,
TARGET: x86_64-unknown-linux-gnu, # 64-bit Linux (kernel 3.2+, glibc 2.17+)
NAME: linux-amd64,
}
- {
OS: ubuntu-latest,
TARGET: aarch64-unknown-linux-gnu, # ARM64 Linux (kernel 4.1, glibc 2.17+)
NAME: linux-arm64,
}
- {
OS: windows-latest,
TARGET: x86_64-pc-windows-msvc, # 64-bit MSVC (Windows 10+, Windows Server 2016+)
NAME: windows-amd64,
}
- {
OS: windows-latest,
TARGET: i686-pc-windows-msvc, # 32-bit MSVC (Windows 10+, Windows Server 2016+)
NAME: windows-i686,
}
runs-on: ${{ matrix.OS }}
env:
TARGET: ${{ matrix.TARGET }}
OS: ${{ matrix.OS }}
NAME: ${{ matrix.NAME }}
steps:
- uses: actions/checkout@v4
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
./target
key: build-cargo-registry-${{matrix.TARGET}}
- name: Install and configure dependencies
shell: bash
run: |
# init packages essential to make cross-compilation
if [[ $TARGET == "i686-unknown-linux-gnu" ]]; then
packages="gcc-multilib g++-multilib"
elif [[ $TARGET == "aarch64-unknown-linux-gnu" ]]; then
packages="crossbuild-essential-arm64"
fi
# install packages
if [[ -n $packages ]]; then
sudo apt-get update
sudo apt-get install -y $packages
fi
# configure Cargo for cross-compilation on linux
cat >>~/.cargo/config <<EOF
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
EOF
- name: Install rust target
shell: bash
run: rustup target add $TARGET
- name: Extract project name
shell: bash
run: echo "PROJECT_NAME=$(grep '^name' Cargo.toml | sed 's/^name *= *//;s/\"//g')" >> $GITHUB_ENV
- name: Set release tag
shell: bash
run: |
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then
TAG=$GITHUB_REF_NAME
else
TAG=$GITHUB_SHA
fi
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Run build
run: make release TARGET=${{ env.TARGET }}
- name: List target
shell: bash
run: ls -R ./target
- name: Compress
shell: bash
run: |
mkdir -p ./artifacts
# windows is the only OS using a different convention for executable file name
if [[ $OS =~ ^windows.*$ ]]; then
EXEC=$PROJECT_NAME.exe
else
EXEC=$PROJECT_NAME
fi
mv ./target/$TARGET/release/$EXEC ./$EXEC
tar -czf ./artifacts/$PROJECT_NAME-$NAME-$TAG.tgz $EXEC
- name: Archive artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-${{ matrix.NAME }}-${{ env.TAG }}
path: ./artifacts/${{ env.PROJECT_NAME }}-${{ matrix.NAME }}-${{ env.TAG }}.tgz
# deploys to github releases on tag
deploy:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R ./artifacts
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/*.tgz