diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..dbfde35 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,67 @@ +name: Create Release + +on: + push: + tags: + - 'v*' # Trigger when a commit is tagged with a new version. TODO: Use a filter pattern for major releases only. + +jobs: + create_release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + name: ${{ github.ref_name }} + draft: false + prerelease: false + generate_release_notes: true + + build_release: + name: Build Release + needs: create_release + runs-on: ${{ matrix.os }} + strategy: + matrix: + name: [ + linux, + macos + ] + + include: + - name: linux + os: ubuntu-latest + artifact_path: target/release/phoenix-cli + asset_name: phoenix-cli-linux + - name: macos + os: macos-latest + artifact_path: target/release/phoenix-cli + asset_name: phoenix-cli-macos + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Use Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - name: Build + run: cargo build --release --locked + + - name: Rename executable based on OS + env: + ASSET_NAME: ${{matrix.asset_name}} + EXEC_PATH: ${{matrix.artifact_path}} + run: | + echo "asset name: ${ASSET_NAME} executable path: ${EXEC_PATH}" + mv ${EXEC_PATH} ${ASSET_NAME} + + - name: Upload binaries to release + uses: softprops/action-gh-release@v1 + with: + files: ${{matrix.asset_name}} + fail_on_unmatched_files: true diff --git a/phoenix-cli-install.sh b/phoenix-cli-install.sh old mode 100644 new mode 100755 index f5b6cde..4486245 --- a/phoenix-cli-install.sh +++ b/phoenix-cli-install.sh @@ -41,15 +41,18 @@ case "$PROCESSOR" in esac BIN="phoenix-cli" -VERSION="0.1.0-x86_64-unknown-linux-gnu" +SUFFIX="linux" if [ "$OS_FLAVOUR" = Darwin ]; then + SUFFIX="macos" +fi - VERSION="0.1.0-x86_64-apple-darwin" - +if ["$OS_FLAVOUR" = Windows ]; then + echo "Windows is not currently supported using this installer." + exit 1 fi -DIST="$VERSION" +DIST="verifier-cli-$SUFFIX" # creates a temporary directory to save the distribution file SOURCE="$(mktemp -d)" @@ -58,9 +61,9 @@ echo "$(CYN "1.") 🖥 $(CYN "Downloading distribution")" echo "" # downloads the distribution file -REMOTE="https://github.com/Ellipsis-Labs/phoenix-cli/releases/download/v0.1.0/" -echo " => downloading from: $(CYN $REMOTE$BIN"-"$DIST)" -curl -L $REMOTE$BIN"-"$DIST --output "$SOURCE/$DIST" +REMOTE="https://github.com/Ellipsis-Labs/phoenix-cli/releases/latest/download/" +echo " => downloading from: $(CYN $REMOTE$DIST)" +curl -L $REMOTE$DIST --output "$SOURCE/$DIST" abort_on_error $? SIZE=$(wc -c "$SOURCE/$DIST" | grep -oE "[0-9]+" | head -n 1)