Skip to content

macos installer for the build-release jobs #13

macos installer for the build-release jobs

macos installer for the build-release jobs #13

Workflow file for this run

name: build-release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ 'main' ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
os: [ubuntu, macos, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- name: setup
shell: bash
run: |
if [[ "$RUNNER_OS" == Windows ]]; then
build_file_name=mdq.exe
else
build_file_name=mdq
fi
echo "BUILD_FILE_NAME=${build_file_name}" >> "$GITHUB_ENV"
env:
MATRIX_OS: ${{ matrix.os }}
- name: rustc version
run: rustc --version --verbose
- uses: actions/checkout@v4
- name: build
run: cargo build --release
- name: set permission
run: chmod +x target/release/$BUILD_FILE_NAME
- name: sha256sum
shell: bash
run: |
if [[ "$RUNNER_OS" == macOS ]]; then
function sha256sum() {
shasum -a 256 "$@"
}
fi
printf '::notice title=sha256sum %s (%s)::%s\n' "$BUILD_FILE_NAME" "$MATRIX_OS" "$(sha256sum "target/release/${BUILD_FILE_NAME}" | cut -f1 -d' ')"
env:
MATRIX_OS: ${{ matrix.os }}
- name: mac installer
if: ${{ env.RUNNER_OS }} == macOS
run: |
tmp_file="$(mktemp)"
cp scripts/installer.sh "$tmp_file"
base64 -b 72 -i target/release/mdq | sed 's/^/# /' >> "$tmp_file"
chmod +x "$tmp_file"
mv "$tmp_file" target/release/mdq-installer.sh
echo BUILD_FILE_NAME=mdq-installer.sh >> "$GITHUB_ENV"
printf '::notice title=sha256sum %s (%s)::%s\n' "$BUILD_FILE_NAME" "$MATRIX_OS" "$(shasum -a 256 "target/release/${BUILD_FILE_NAME}" | cut -f1 -d' ')"
- name: upload
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: mdq-${{ matrix.os }}
path: target/release/${{ env.BUILD_FILE_NAME }}