0.15.0 #174
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: Build and release CLI | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
target: | |
- aarch64-unknown-linux-gnu | |
- x86_64-unknown-linux-gnu | |
- aarch64-apple-darwin | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-msvc | |
include: | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-20.04 | |
ext: '' | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-20.04 | |
ext: '' | |
- target: aarch64-apple-darwin | |
os: macos-11.0 | |
ext: '' | |
- target: x86_64-apple-darwin | |
os: macos-11.0 | |
ext: '' | |
- target: x86_64-pc-windows-msvc | |
os: windows-2019 | |
ext: '.exe' | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Get version | |
id: version | |
shell: bash | |
run: echo ::set-output name=VERSION::"$([[ "$GITHUB_REF" == refs/tags/v* ]] && echo ${GITHUB_REF#refs/tags/v} || echo '0.0.0')" | |
- name: Get file name | |
id: file | |
shell: bash | |
run: echo ::set-output name=FILE::minhtml-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.ext }} | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Set up cross compiler | |
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} | |
run: sudo apt install -y gcc-aarch64-linux-gnu | |
- name: Build CLI | |
working-directory: ./minhtml | |
shell: bash | |
run: | | |
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc | |
cargo build --release --target ${{ matrix.target }} | |
# upload-artifact does not rename the file, so when we download if we don't rename all files will have the same name. | |
mv -v ../target/${{ matrix.target }}/release/minhtml${{ matrix.ext }} ${{ steps.file.outputs.FILE }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.file.outputs.FILE }} | |
path: minhtml/${{ steps.file.outputs.FILE }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: '.' | |
merge-multiple: true | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: '*' |