Skip to content

chore: github action #9

chore: github action

chore: github action #9

Workflow file for this run

name: build
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
permissions:
contents: write
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos, windows]
include:
- build: linux
os: ubuntu-latest
rust: nightly
target: x86_64-unknown-linux-musl
archive-name: npack-linux.tar.gz
- build: macos
os: macos-latest
rust: nightly
target: x86_64-apple-darwin
archive-name: npack-macos.tar.gz
- build: macos-aarch64
os: macos-latest
rust: nightly
target: aarch64-apple-darwin
archive-name: npack-macos-aarch64.tar.gz
- build: windows
os: windows-2019
rust: nightly-x86_64-msvc
target: x86_64-pc-windows-msvc
archive-name: npack-windows.7z
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build binary
run: cargo build --verbose --release --target ${{ matrix.target }}
env:
RUST_BACKTRACE: 1
- name: Strip binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos'
run: |
strip "target/${{ matrix.target }}/release/na"
strip "target/${{ matrix.target }}/release/nci"
strip "target/${{ matrix.target }}/release/ni"
strip "target/${{ matrix.target }}/release/nlx"
strip "target/${{ matrix.target }}/release/nr"
strip "target/${{ matrix.target }}/release/nu"
strip "target/${{ matrix.target }}/release/nun"
- name: Build archive
shell: bash
run: |
mkdir archive
cp LICENSE README.md archive/
cd archive
if [ "${{ matrix.build }}" = "windows" ]; then
cp "../target/${{ matrix.target }}/release/na.exe" ./
cp "../target/${{ matrix.target }}/release/nci.exe" ./
cp "../target/${{ matrix.target }}/release/ni.exe" ./
cp "../target/${{ matrix.target }}/release/nlx.exe" ./
cp "../target/${{ matrix.target }}/release/nr.exe" ./
cp "../target/${{ matrix.target }}/release/nu.exe" ./
cp "../target/${{ matrix.target }}/release/nun.exe" ./
7z a "${{ matrix.archive-name }}" LICENSE README.md na.exe nci.exe ni.exe nlx.exe nr.exe nu.exe nun.exe
else
cp "../target/${{ matrix.target }}/release/na" ./
cp "../target/${{ matrix.target }}/release/nci" ./
cp "../target/${{ matrix.target }}/release/ni" ./
cp "../target/${{ matrix.target }}/release/nlx" ./
cp "../target/${{ matrix.target }}/release/nr" ./
cp "../target/${{ matrix.target }}/release/nu" ./
cp "../target/${{ matrix.target }}/release/nun" ./
tar -czf "${{ matrix.archive-name }}" LICENSE README.md na nci ni nlx nr nu nun
fi
- name: Calculate SHA256
id: hash
run: |
echo "::set-output name=sha256::$(shasum -a 256 archive/${{ matrix.archive-name }} | awk '{print $1}')"
- name: Create SHA256 File
run: echo "${{ steps.hash.outputs.sha256 }}" > "${{ matrix.archive-name }}.sha256"
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
archive/${{ matrix.archive-name }}
${{ matrix.archive-name }}.sha256