fix release #121
Workflow file for this run
This file contains hidden or 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 | |
on: | |
push: | |
# TODO: debug | |
# tags: | |
# - v* | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
build: | |
# TODO: debug | |
# - target: x86_64-apple-darwin | |
# os: macos-latest | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
# TODO: debug | |
# - target: x86_64-pc-windows-msvc | |
# os: windows-latest | |
# - target: aarch64-pc-windows-msvc | |
# os: windows-latest | |
runs-on: ${{ matrix.build.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install target | |
run: rustup target add ${{ matrix.build.target }} | |
- name: Setup musl | |
run: sudo apt-get install -y musl-tools | |
if: endsWith(matrix.build.target, '-musl') | |
- name: Setup windows | |
run: | | |
# setup perl for bash shell https://github.com/sfackler/rust-openssl/issues/2149#issuecomment-2014064057 | |
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
if: runner.os == 'Windows' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build | |
env: | |
TARGET: ${{ matrix.build.target }} | |
shell: bash | |
run: | | |
declare output | |
output="$( | |
cargo build \ | |
--workspace \ | |
--release \ | |
--target "$TARGET" \ | |
--message-format=json \ | |
| jq -r '.message.rendered // .executable // empty' | |
)" | |
{ | |
echo 'ARTIFACT_PATHS<<EOF' | |
echo "$output" | |
echo 'EOF' | |
} >> "$GITHUB_ENV" | |
# TODO: debug | |
- run: echo $ARTIFACT_PATHS | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.build.target }} | |
path: ${{ env.ARTIFACT_PATHS }} | |
if-no-files-found: error | |
release: | |
name: Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Create Release | |
env: | |
GITHUB_USER: ${{ github.repository_owner }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
mkdir assets | |
# TODO: debug | |
echo 'artifacts' | |
tree artifacts | |
# move binaries to assets directory | |
for path in artifacts/*; do | |
declare artifact="$(basename "$path")" | |
mv "${path}/nk"* "assets/${artifact}" | |
done | |
# TODO: debug | |
echo 'assets' | |
tree assets | |
# create release | |
# TODO: debug | |
echo gh release create \ | |
--title "$GITHUB_REF_NAME" \ | |
--notes '' \ | |
"$GITHUB_REF_NAME" \ | |
"assets/"* |