Skip to content

Commit

Permalink
feat(install): add installation guide and scripts
Browse files Browse the repository at this point in the history
- Add detailed installation instructions for Windows, Linux, and macOS
- Create install_unix.sh script for easy Unix-based installation
- Update README.md with new installation guide
- Update release workflow to use release-please-action v4
- Update CHANGELOG.md with new version 1.1.0 features
  • Loading branch information
duocnv-firegroup committed Aug 12, 2024
1 parent 6d725de commit fb4fd3f
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v3
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [1.1.0](https://github.com/nguyenvanduocit/epubtrans/compare/v1.0.0...v1.1.0) (2024-08-12)


### Features

* allow slyting command ([fd3c35b](https://github.com/nguyenvanduocit/epubtrans/commit/fd3c35b9a5f1def00edc5b6a56abd94461a4a95f))
* support language config ([8f2c740](https://github.com/nguyenvanduocit/epubtrans/commit/8f2c740d442773bb3c9efe121a62410e200beea6))
* support serve command ([57e3414](https://github.com/nguyenvanduocit/epubtrans/commit/57e34141dbddd63a6aab67bf97bd99fc72e91bcd))

## 1.0.0 (2024-08-02)


Expand Down
79 changes: 76 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,86 @@ You may want to watch the [tutorial video - Vietnamese](https://youtu.be/9MspqDL

## Installation

1. Install Go. You can download it from [here](https://golang.org/dl/).
2. Install the tool
# epubtrans Installation Guide

This guide provides instructions for installing the latest version of epubtrans on Windows, Linux, and macOS.

## Prerequisites

- Windows: PowerShell 5.1 or later
- Linux/macOS: Bash shell
- All systems: Internet connection to download the latest release

## Installation Instructions

### Windows

1. Open PowerShell as Administrator.
2. Run the following commands:

```powershell
$ErrorActionPreference = "Stop"
$version = (Invoke-RestMethod "https://api.github.com/repos/nguyenvanduocit/epubtrans/releases/latest").tag_name
$arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "386" }
$url = "https://github.com/nguyenvanduocit/epubtrans/releases/download/${version}/epubtrans_${version.Substring(1)}_windows_${arch}.tar.gz"
Invoke-WebRequest -Uri $url -OutFile "epubtrans.tar.gz"
tar -xzf epubtrans.tar.gz
Move-Item -Force epubtrans.exe "C:\Windows\System32\"
Remove-Item epubtrans.tar.gz
Write-Host "epubtrans $version has been installed successfully!"
```

### Linux and macOS

Open a terminal and run the following command:

```bash
go install github.com/nguyenvanduocit/epubtrans@latest
bash -c "$(curl -fsSL https://raw.githubusercontent.com/nguyenvanduocit/epubtrans/main/scripts/install_unix.sh)"
```

If the above command doesn't work, you can try the following manual installation steps:

1. Open a terminal.
2. Run the following commands:

```bash
#!/bin/bash
set -e

VERSION=$(curl -s "https://api.github.com/repos/nguyenvanduocit/epubtrans/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $ARCH in
x86_64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
i386|i686) ARCH="386" ;;
esac

DOWNLOAD_URL="https://github.com/nguyenvanduocit/epubtrans/releases/download/${VERSION}/epubtrans_${VERSION#v}_${OS}_${ARCH}.tar.gz"

echo "Downloading epubtrans ${VERSION} for ${OS}_${ARCH}..."
curl -L -o epubtrans.tar.gz "$DOWNLOAD_URL"

echo "Extracting..."
tar -xzf epubtrans.tar.gz

echo "Installing..."
sudo mv epubtrans /usr/local/bin/

echo "Cleaning up..."
rm epubtrans.tar.gz

echo "epubtrans ${VERSION} has been installed successfully!"
```

After installation, verify that epubtrans was installed correctly by opening a new terminal or command prompt and running:

```
epubtrans --version
```

This should display the version number of the installed epubtrans.

## Usage

To manage the translation content, we need to mark the content that needs to be translated, then translate and mark the
Expand Down
47 changes: 47 additions & 0 deletions scripts/install_unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -e

get_latest_version() {
curl --silent "https://api.github.com/repos/nguyenvanduocit/epubtrans/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
}

get_os_arch() {
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

case $ARCH in
x86_64)
ARCH="amd64"
;;
aarch64|arm64)
ARCH="arm64"
;;
i386|i686)
ARCH="386"
;;
esac

echo "${OS}_${ARCH}"
}

VERSION=$(get_latest_version)
OS_ARCH=$(get_os_arch)

DOWNLOAD_URL="https://github.com/nguyenvanduocit/epubtrans/releases/download/${VERSION}/epubtrans_${VERSION#v}_${OS_ARCH}.tar.gz"

echo "Downloading epubtrans ${VERSION} for ${OS_ARCH}..."
curl -L -o epubtrans.tar.gz "$DOWNLOAD_URL"

echo "Extracting..."
tar -xzf epubtrans.tar.gz

echo "Installing..."
sudo mv epubtrans /usr/local/bin/

echo "Cleaning up..."
rm epubtrans.tar.gz

echo "epubtrans ${VERSION} has been installed successfully!"

0 comments on commit fb4fd3f

Please sign in to comment.