chore: Updated cargo file
f4e4c5fd
2 file(s) · +5 −223
| 1 | - | name: Release |
|
| 2 | - | ||
| 3 | - | on: |
|
| 4 | - | push: |
|
| 5 | - | tags: |
|
| 6 | - | - 'v*' |
|
| 7 | - | ||
| 8 | - | env: |
|
| 9 | - | CARGO_TERM_COLOR: always |
|
| 10 | - | ||
| 11 | - | jobs: |
|
| 12 | - | create-release: |
|
| 13 | - | runs-on: ubuntu-latest |
|
| 14 | - | outputs: |
|
| 15 | - | upload_url: ${{ steps.create_release.outputs.upload_url }} |
|
| 16 | - | steps: |
|
| 17 | - | - name: Create Release |
|
| 18 | - | id: create_release |
|
| 19 | - | uses: softprops/action-gh-release@v1 |
|
| 20 | - | env: |
|
| 21 | - | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
| 22 | - | with: |
|
| 23 | - | tag_name: ${{ github.ref }} |
|
| 24 | - | name: Release ${{ github.ref }} |
|
| 25 | - | draft: false |
|
| 26 | - | prerelease: false |
|
| 27 | - | ||
| 28 | - | build-and-upload: |
|
| 29 | - | needs: create-release |
|
| 30 | - | strategy: |
|
| 31 | - | matrix: |
|
| 32 | - | include: |
|
| 33 | - | - os: ubuntu-latest |
|
| 34 | - | target: x86_64-unknown-linux-gnu |
|
| 35 | - | asset_name: walletfetch-linux-x86_64 |
|
| 36 | - | - os: ubuntu-latest |
|
| 37 | - | target: x86_64-unknown-linux-musl |
|
| 38 | - | asset_name: walletfetch-linux-x86_64-musl |
|
| 39 | - | - os: macos-latest |
|
| 40 | - | target: x86_64-apple-darwin |
|
| 41 | - | asset_name: walletfetch-macos-x86_64 |
|
| 42 | - | - os: macos-latest |
|
| 43 | - | target: aarch64-apple-darwin |
|
| 44 | - | asset_name: walletfetch-macos-aarch64 |
|
| 45 | - | - os: windows-latest |
|
| 46 | - | target: x86_64-pc-windows-msvc |
|
| 47 | - | asset_name: walletfetch-windows-x86_64.exe |
|
| 48 | - | runs-on: ${{ matrix.os }} |
|
| 49 | - | steps: |
|
| 50 | - | - uses: actions/checkout@v4 |
|
| 51 | - | ||
| 52 | - | - name: Install Rust |
|
| 53 | - | uses: dtolnay/rust-toolchain@stable |
|
| 54 | - | with: |
|
| 55 | - | targets: ${{ matrix.target }} |
|
| 56 | - | ||
| 57 | - | - name: Install musl-tools (Linux musl only) |
|
| 58 | - | if: matrix.target == 'x86_64-unknown-linux-musl' |
|
| 59 | - | run: sudo apt-get update && sudo apt-get install -y musl-tools |
|
| 60 | - | ||
| 61 | - | - name: Build |
|
| 62 | - | run: cargo build --release --target ${{ matrix.target }} |
|
| 63 | - | ||
| 64 | - | - name: Create archive (Unix) |
|
| 65 | - | if: matrix.os != 'windows-latest' |
|
| 66 | - | run: | |
|
| 67 | - | cd target/${{ matrix.target }}/release |
|
| 68 | - | tar czf ../../../${{ matrix.asset_name }}.tar.gz walletfetch |
|
| 69 | - | ||
| 70 | - | - name: Create archive (Windows) |
|
| 71 | - | if: matrix.os == 'windows-latest' |
|
| 72 | - | run: | |
|
| 73 | - | cd target/${{ matrix.target }}/release |
|
| 74 | - | 7z a ../../../${{ matrix.asset_name }}.zip walletfetch.exe |
|
| 75 | - | ||
| 76 | - | - name: Upload Release Asset (Unix) |
|
| 77 | - | if: matrix.os != 'windows-latest' |
|
| 78 | - | uses: softprops/action-gh-release@v1 |
|
| 79 | - | env: |
|
| 80 | - | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
| 81 | - | with: |
|
| 82 | - | tag_name: ${{ github.ref }} |
|
| 83 | - | files: ./${{ matrix.asset_name }}.tar.gz |
|
| 84 | - | ||
| 85 | - | - name: Upload Release Asset (Windows) |
|
| 86 | - | if: matrix.os == 'windows-latest' |
|
| 87 | - | uses: softprops/action-gh-release@v1 |
|
| 88 | - | env: |
|
| 89 | - | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
| 90 | - | with: |
|
| 91 | - | tag_name: ${{ github.ref }} |
|
| 92 | - | files: ./${{ matrix.asset_name }}.zip |
|
| 93 | - | ||
| 94 | - | publish-crates: |
|
| 95 | - | needs: build-and-upload |
|
| 96 | - | runs-on: ubuntu-latest |
|
| 97 | - | steps: |
|
| 98 | - | - uses: actions/checkout@v4 |
|
| 99 | - | ||
| 100 | - | - name: Install Rust |
|
| 101 | - | uses: dtolnay/rust-toolchain@stable |
|
| 102 | - | ||
| 103 | - | - name: Publish to crates.io |
|
| 104 | - | run: cargo publish --token ${{ secrets.CRATES_TOKEN }} |
|
| 105 | - | ||
| 106 | - | update-homebrew: |
|
| 107 | - | needs: build-and-upload |
|
| 108 | - | runs-on: ubuntu-latest |
|
| 109 | - | steps: |
|
| 110 | - | - uses: actions/checkout@v4 |
|
| 111 | - | ||
| 112 | - | - name: Get release info |
|
| 113 | - | id: get_release |
|
| 114 | - | run: | |
|
| 115 | - | TAG_NAME=${GITHUB_REF#refs/tags/} |
|
| 116 | - | echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT |
|
| 117 | - | echo "version=${TAG_NAME#v}" >> $GITHUB_OUTPUT |
|
| 118 | - | ||
| 119 | - | - name: Update Homebrew formula |
|
| 120 | - | run: | |
|
| 121 | - | # Download the macOS x86_64 binary to calculate SHA256 |
|
| 122 | - | curl -L -o macos-binary.tar.gz \ |
|
| 123 | - | "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_release.outputs.tag_name }}/walletfetch-macos-x86_64.tar.gz" |
|
| 124 | - | ||
| 125 | - | SHA256=$(shasum -a 256 macos-binary.tar.gz | cut -d' ' -f1) |
|
| 126 | - | ||
| 127 | - | # Clone your homebrew tap repository |
|
| 128 | - | git clone https://github.com/stevedylandev/homebrew-walletfetch.git |
|
| 129 | - | cd homebrew-walletfetch |
|
| 130 | - | ||
| 131 | - | # Update the formula |
|
| 132 | - | cat > Formula/walletfetch.rb << EOF |
|
| 133 | - | class Walletfetch < Formula |
|
| 134 | - | desc "Like Neofetch, but for your wallet" |
|
| 135 | - | homepage "https://github.com/stevedylandev/walletfetch" |
|
| 136 | - | url "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_release.outputs.tag_name }}/walletfetch-macos-x86_64.tar.gz" |
|
| 137 | - | sha256 "$SHA256" |
|
| 138 | - | version "${{ steps.get_release.outputs.version }}" |
|
| 139 | - | ||
| 140 | - | def install |
|
| 141 | - | bin.install "walletfetch" |
|
| 142 | - | end |
|
| 143 | - | ||
| 144 | - | test do |
|
| 145 | - | system "#{bin}/walletfetch", "--version" |
|
| 146 | - | end |
|
| 147 | - | end |
|
| 148 | - | EOF |
|
| 149 | - | ||
| 150 | - | # Commit and push changes |
|
| 151 | - | git config user.name "Steve Simkins" |
|
| 152 | - | git config user.email "stevedsimkins@gmail.com" |
|
| 153 | - | git add Formula/walletfetch.rb |
|
| 154 | - | git commit -m "Update walletfetch to ${{ steps.get_release.outputs.version }}" |
|
| 155 | - | git push https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/stevedylandev/homebrew-walletfetch.git |
|
| 156 | - | ||
| 157 | - | create-install-script: |
|
| 158 | - | needs: build-and-upload |
|
| 159 | - | runs-on: ubuntu-latest |
|
| 160 | - | steps: |
|
| 161 | - | - uses: actions/checkout@v4 |
|
| 162 | - | ||
| 163 | - | - name: Generate install script |
|
| 164 | - | run: | |
|
| 165 | - | mkdir -p scripts |
|
| 166 | - | cat > scripts/install.sh << 'EOF' |
|
| 167 | - | #!/bin/bash |
|
| 168 | - | set -e |
|
| 169 | - | ||
| 170 | - | # Detect OS and architecture |
|
| 171 | - | OS=$(uname -s | tr '[:upper:]' '[:lower:]') |
|
| 172 | - | ARCH=$(uname -m) |
|
| 173 | - | ||
| 174 | - | case $OS in |
|
| 175 | - | linux) |
|
| 176 | - | case $ARCH in |
|
| 177 | - | x86_64) BINARY="walletfetch-linux-x86_64" ;; |
|
| 178 | - | *) echo "Unsupported architecture: $ARCH"; exit 1 ;; |
|
| 179 | - | esac |
|
| 180 | - | ;; |
|
| 181 | - | darwin) |
|
| 182 | - | case $ARCH in |
|
| 183 | - | x86_64) BINARY="walletfetch-macos-x86_64" ;; |
|
| 184 | - | arm64) BINARY="walletfetch-macos-aarch64" ;; |
|
| 185 | - | *) echo "Unsupported architecture: $ARCH"; exit 1 ;; |
|
| 186 | - | esac |
|
| 187 | - | ;; |
|
| 188 | - | *) |
|
| 189 | - | echo "Unsupported OS: $OS" |
|
| 190 | - | exit 1 |
|
| 191 | - | ;; |
|
| 192 | - | esac |
|
| 193 | - | ||
| 194 | - | # Get latest release |
|
| 195 | - | LATEST_RELEASE=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') |
|
| 196 | - | ||
| 197 | - | # Download and install |
|
| 198 | - | DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/${LATEST_RELEASE}/${BINARY}.tar.gz" |
|
| 199 | - | INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}" |
|
| 200 | - | ||
| 201 | - | echo "Downloading $BINARY from $DOWNLOAD_URL..." |
|
| 202 | - | curl -L "$DOWNLOAD_URL" | tar -xz -C /tmp |
|
| 203 | - | ||
| 204 | - | # Create install directory if it doesn't exist |
|
| 205 | - | mkdir -p "$INSTALL_DIR" |
|
| 206 | - | ||
| 207 | - | # Move binary to install directory |
|
| 208 | - | mv /tmp/walletfetch "$INSTALL_DIR/" |
|
| 209 | - | chmod +x "$INSTALL_DIR/walletfetch" |
|
| 210 | - | ||
| 211 | - | echo "walletfetch installed to $INSTALL_DIR/walletfetch" |
|
| 212 | - | echo "Make sure $INSTALL_DIR is in your PATH" |
|
| 213 | - | EOF |
|
| 214 | - | ||
| 215 | - | chmod +x scripts/install.sh |
|
| 216 | - | ||
| 217 | - | - name: Upload install script |
|
| 218 | - | uses: softprops/action-gh-release@v1 |
|
| 219 | - | env: |
|
| 220 | - | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
| 221 | - | with: |
|
| 222 | - | tag_name: ${{ github.ref }} |
|
| 223 | - | files: ./scripts/install.sh |
| 1 | 1 | [package] |
|
| 2 | 2 | name = "walletfetch" |
|
| 3 | + | description = "Like Neofetch, but for your wallet" |
|
| 4 | + | homepage = "https://github.com/stevedylandev/walletfetch" |
|
| 5 | + | repository = "stevedylandev/walletfetch" |
|
| 6 | + | readme = "README.md" |
|
| 3 | 7 | version = "0.0.1" |
|
| 4 | 8 | edition = "2024" |
|
| 9 | + | license = "MIT" |
|
| 5 | 10 | ||
| 6 | 11 | [dependencies] |
|
| 7 | 12 | clap = { version = "4.4", features = ["derive"] } |