Fix install #45
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 On macOS" | |
on: [push] | |
jobs: | |
build: # job id, can be any string | |
# Job name is Build And Publish | |
name: Build | |
# This job runs on Linux | |
strategy: | |
matrix: | |
os: [macOS-latest] | |
rust: [stable] | |
target: [x86_64-apple-darwin] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache cargo modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
default: true | |
override: true | |
components: "rustfmt, clippy, cargo, rust-docs" | |
- name: Cargo Release build | |
uses: actions-rs/cargo@v1 | |
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }} | |
with: | |
use-cross: false | |
command: build | |
args: --target ${{ matrix.target }} --release --jobs 2 --verbose | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --release --verbose --target ${{ matrix.target }} --bin ddns-cli | |
- name: Prepare package | |
shell: bash | |
if: ${{ contains(github.ref, 'refs/tags/') }} | |
run: | | |
cd "$GITHUB_WORKSPACE/target/${{ matrix.target }}/release/" ; | |
mkdir -p bin; | |
if [[ -e ddns-cli ]]; then | |
cp -f ddns-cli bin/ddns-cli ; | |
elif [[ -e "ddns-cli.exe" ]]; then | |
cp -f ddns-cli.exe bin/ddns-cli.exe ; | |
else | |
cp -f ddns-cli* bin/ ; | |
fi | |
tar -zcvf ${{ matrix.target }}.tar.gz bin ; | |
cd "$GITHUB_WORKSPACE" ; | |
- uses: xresloader/upload-to-github-release@master | |
if: ${{ contains(github.ref, 'refs/tags/') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "target/${{ matrix.target }}/release/${{ matrix.target }}.tar.gz" | |
tags: true | |
draft: false | |
prerelease: false | |
overwrite: true |