mirror of
https://github.com/bgreenwell/lstr.git
synced 2025-12-16 12:00:11 +01:00
fix release workflow
This commit is contained in:
80
.github/workflows/release.yml
vendored
80
.github/workflows/release.yml
vendored
@@ -75,19 +75,34 @@ jobs:
|
||||
- name: Prepare package
|
||||
shell: bash
|
||||
run: |
|
||||
# Exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
|
||||
PACKAGE_NAME="lstr-${{ matrix.asset_name_suffix }}"
|
||||
STAGING_DIR="staging"
|
||||
|
||||
mkdir "$STAGING_DIR"
|
||||
|
||||
# Determine the binary path and name based on OS
|
||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||
cp "target/${{ matrix.target }}/release/lstr.exe" "$STAGING_DIR/"
|
||||
SOURCE_BINARY_PATH="target/${{ matrix.target }}/release/lstr.exe"
|
||||
else
|
||||
cp "target/${{ matrix.target }}/release/lstr" "$STAGING_DIR/"
|
||||
SOURCE_BINARY_PATH="target/${{ matrix.target }}/release/lstr"
|
||||
fi
|
||||
|
||||
# --- ADDED VERIFICATION ---
|
||||
echo "Verifying binary exists at: ${SOURCE_BINARY_PATH}"
|
||||
if [ ! -f "$SOURCE_BINARY_PATH" ]; then
|
||||
echo "::error::Binary not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$SOURCE_BINARY_PATH" "$STAGING_DIR/"
|
||||
|
||||
# We should also add a LICENSE file to the repository root
|
||||
# For now, I'll make this step non-fatal
|
||||
cp README.md "$STAGING_DIR/"
|
||||
cp LICENSE "$STAGING_DIR/"
|
||||
cp LICENSE "$STAGING_DIR/" || echo "LICENSE file not found, skipping."
|
||||
|
||||
echo "--- Contents of staging directory ---"
|
||||
ls -R "$STAGING_DIR"
|
||||
@@ -95,14 +110,9 @@ jobs:
|
||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||
7z a "$PACKAGE_NAME" "./$STAGING_DIR/*"
|
||||
else
|
||||
# Corrected tar command: Create archive in the current directory
|
||||
tar -czf "$PACKAGE_NAME" -C "$STAGING_DIR" .
|
||||
fi
|
||||
|
||||
echo "--- Contents of workspace after archiving ---"
|
||||
ls -R .
|
||||
echo "ASSET will be set to: $PACKAGE_NAME"
|
||||
|
||||
echo "ASSET=$PACKAGE_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Release Asset
|
||||
@@ -113,4 +123,56 @@ jobs:
|
||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||
asset_path: ${{ env.ASSET }}
|
||||
asset_name: ${{ env.ASSET }}
|
||||
asset_content_type: application/octet-stream
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
update-homebrew-tap:
|
||||
name: Update Homebrew Tap
|
||||
needs: build-and-upload
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout lstr repo (for release assets)
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download macOS release assets
|
||||
run: |
|
||||
gh release download ${{ github.ref_name }} --pattern 'lstr-macos-*.tar.gz'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Calculate Checksums
|
||||
id: checksums
|
||||
run: |
|
||||
echo "sha256_x86_64=$(shasum -a 256 lstr-macos-x86_64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
echo "sha256_arm64=$(shasum -a 256 lstr-macos-arm64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Checkout homebrew-lstr repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: bgreenwell/homebrew-lstr
|
||||
path: homebrew-lstr
|
||||
token: ${{ secrets.PAT_FOR_HOMEBREW_TAP }}
|
||||
|
||||
- name: Update Homebrew Formula
|
||||
run: |
|
||||
# The version number is derived from the git tag (e.g., v0.2.1 -> 0.2.1)
|
||||
VERSION="${{ github.ref_name }}"
|
||||
VERSION=${VERSION#v}
|
||||
|
||||
# Use sed to update the formula file
|
||||
sed -i "s/version \".*\"/version \"${VERSION}\"/" homebrew-lstr/Formula/lstr.rb
|
||||
sed -i "s|url \".*/lstr-macos-x86_64.tar.gz\"|url \"https://github.com/bgreenwell/lstr/releases/download/${{ github.ref_name }}/lstr-macos-x86_64.tar.gz\"|" homebrew-lstr/Formula/lstr.rb
|
||||
sed -i "s/sha256 \".*\" # x86_64/sha256 \"${{ steps.checksums.outputs.sha256_x86_64 }}\" # x86_64/" homebrew-lstr/Formula/lstr.rb
|
||||
sed -i "s|url \".*/lstr-macos-arm64.tar.gz\"|url \"https://github.com/bgreenwell/lstr/releases/download/${{ github.ref_name }}/lstr-macos-arm64.tar.gz\"|" homebrew-lstr/Formula/lstr.rb
|
||||
sed -i "s/sha256 \".*\" # arm64/sha256 \"${{ steps.checksums.outputs.sha256_arm64 }}\" # arm64/" homebrew-lstr/Formula/lstr.rb
|
||||
|
||||
echo "--- Updated lstr.rb ---"
|
||||
cat homebrew-lstr/Formula/lstr.rb
|
||||
|
||||
- name: Commit and Push Changes
|
||||
run: |
|
||||
cd homebrew-lstr
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add Formula/lstr.rb
|
||||
git commit -m "Update lstr to ${{ github.ref_name }}" || echo "No changes to commit"
|
||||
git push
|
||||
|
||||
19
README.md
19
README.md
@@ -30,16 +30,29 @@ A fast, minimalist directory tree viewer, written in Rust. Inspired by the comma
|
||||
|
||||
## Installation
|
||||
|
||||
You need the Rust toolchain installed on your system to build `lstr`. Or use `nix develop` command to create development environment.
|
||||
### With Homebrew (macOS)
|
||||
|
||||
The easiest way to install `lstr` on macOS is with Homebrew.
|
||||
|
||||
```bash
|
||||
# First, tap our repository
|
||||
brew tap bgreenwell/lstr
|
||||
|
||||
# Now, install lstr
|
||||
brew install lstr
|
||||
```
|
||||
|
||||
### From source (all platforms)
|
||||
|
||||
You need the Rust toolchain installed on your system to build `lstr`.
|
||||
|
||||
1. **Clone the repository:**
|
||||
```bash
|
||||
git clone https://github.com/bgreenwell/lstr.git
|
||||
git clone [https://github.com/bgreenwell/lstr.git](https://github.com/bgreenwell/lstr.git)
|
||||
cd lstr
|
||||
```
|
||||
2. **Build and install using Cargo:**
|
||||
```bash
|
||||
# This compiles in release mode and copies the binary to ~/.cargo/bin
|
||||
cargo install --path .
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user