Skip to content

Commit

Permalink
Add macos aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
jareddlc committed Aug 25, 2024
1 parent c60da25 commit 7e2cd9d
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 20 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
name: windows-binary
path: target\release\gut.exe

build_macos:
build_macos_x86:
runs-on: macos-latest

steps:
Expand All @@ -54,17 +54,36 @@ jobs:
run: cargo build --release

- name: Rename binary
run: mv target/release/gut target/release/gut-macos
run: mv target/release/gut target/release/gut-macos-x86

- name: Upload MacOS Artifact
uses: actions/upload-artifact@v2
with:
name: macos-binary
path: target/release/gut-macos
name: macos-x86-binary
path: target/release/gut-macos-x86

build_macos_aarch64:
runs-on: macos-14

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build
run: cargo build --release

- name: Rename binary
run: mv target/release/gut target/release/gut-macos-aarch64

- name: Upload MacOS Artifact
uses: actions/upload-artifact@v2
with:
name: macos-aarch64-binary
path: target/release/gut-macos-aarch64

release_all:
runs-on: ubuntu-latest
needs: [build_linux, build_windows, build_macos]
needs: [build_linux, build_windows, build_macos_x86, build_macos_aarch64]

steps:
- name: Download Linux Artifact
Expand All @@ -75,10 +94,14 @@ jobs:
uses: actions/download-artifact@v2
with:
name: windows-binary
- name: Download MacOS Artifact
- name: Download MacOS (x86) Artifact
uses: actions/download-artifact@v2
with:
name: macos-x86-binary
- name: Download MacOS (Arm64) Artifact
uses: actions/download-artifact@v2
with:
name: macos-binary
name: macos-aarch64-binary

- name: Release
uses: "marvinpinto/action-automatic-releases@latest"
Expand All @@ -89,4 +112,5 @@ jobs:
files: |
gut-linux
gut.exe
gut-macos
gut-macos-x86
gut-macos-aarch64
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Collection of plugins that simplifies development workflow
* [gut-plugin](https://github.com/gut-hub/gut-plugin)
* [gut-lib](https://github.com/gut-hub/gut-lib)

## Supported OS

* MacOs (x86)
* MacOs (arm64)
* Linux
* Windows

## Install

This will create the gut directory: `$HOME/.gut`
Expand All @@ -29,3 +36,7 @@ See [gut-plugin](https://github.com/gut-hub/gut-plugin)
Helper library that provides common functionality for Gut

See [gut-lib](https://github.com/gut-hub/gut-lib)

## Develop

__Note:__ The gut directory `$HOME/.gut` needs to exist.
43 changes: 33 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
#!/usr/bin/env bash

# Colors
RED="\033[0;31m"
GRE="\033[0;32m"
YEL="\033[0;33m"
BLU="\033[0;34m"
DEF="\033[0;39m"
RES="\033[0m"

# Vars
BASH_PROFILE="${HOME}/.bash_profile"
BASH_RC="${HOME}/.bashrc"
# GUT
GUT_DIR="${HOME}/.gut"
GUT_PATH='export PATH=$PATH:$HOME/.gut'

# Shells
BASH_PROFILE="${HOME}/.bash_profile"
BASH_RC="${HOME}/.bashrc"
ZSH_PROFILE="${HOME}/.zprofile"
ZSH_RC="${HOME}/.zshrc"

# OS and Arch
arch=$(uname -m)
GUT_FILE="gut-linux"
if [[ "$OSTYPE" == "darwin"* ]]; then
GUT_FILE="gut-macos"
GUT_FILE="gut-macos-x86"
if [[ "$arch" == "arm64"* ]]; then
GUT_FILE="gut-macos-aarch64"
fi
fi

# Create gut directory
Expand Down Expand Up @@ -52,13 +63,25 @@ insert_source() {
echo -e "${BLU} $ source ${dest}${DEF}"
}

# Add source information to .bash_profile or .bashrc
if [ -e "${BASH_PROFILE}" ]; then
# Add source to shell
echo -e "${RED}Select a shell profile to add gut to PATH:${DEF}"
echo -e "1) ${ZSH_PROFILE}"
echo -e "2) ${ZSH_RC}"
echo -e "3) ${BASH_PROFILE}"
echo -e "4) ${BASH_RC}"
echo -e "5) None"
read -r input

if [[ "$input" == "1" ]]; then
insert_source "${ZSH_PROFILE}"
elif [[ "$input" == "2" ]]; then
insert_source "${ZSH_RC}"
elif [[ "$input" == "3" ]]; then
insert_source "${BASH_PROFILE}"
elif [ -e "${BASH_RC}" ]; then
elif [[ "$input" == "4" ]]; then
insert_source "${BASH_RC}"
else
echo -e "${YEL}Did not find a .bash_profile or .bashrc${DEF}"
echo -e "${YEL}To use gut, Please add gut directory to the PATH:${RES}"
echo -e "${BLU}source ${GUT_EXEC}"
echo -e "${YEL}gut not added to a shell profile.${DEF}"
echo -e "${YEL}To use gut, Please add gut directory to the PATH:${DEF}"
echo -e "${BLU}export PATH=\$PATH:\$HOME/.gut${DEF}"
fi
2 changes: 1 addition & 1 deletion src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn download_gut(file_name: String) {

// download the file
println!("Downloading: {}", file_name);
let res = reqwest::blocking::get(download_url).expect("Failed to download plugins");
let res = reqwest::blocking::get(download_url).expect("Failed to download gut");
let data = res.bytes().expect("Failed to get plugin bytes");

// write the file
Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ fn update() {
// determine gut version to download
let mut file_name = "".to_string();
if env::consts::OS == "macos" {
file_name = "gut-macos".to_string();
// check arch
if env::consts::ARCH == "aarch64" {
file_name = "gut-macos-aarch64".to_string();
} else {
file_name = "gut-macos-x86".to_string();
}
} else if env::consts::OS == "linux" {
file_name = "gut-linux".to_string();
} else if env::consts::OS == "windows" {
Expand Down

0 comments on commit 7e2cd9d

Please sign in to comment.