feat: Added releases and license e4da45d6
stevedylandev · 2025-07-09 19:38 3 file(s) · +288 −0
.github/workflows/release.yaml (added) +240 −0
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: actions/create-release@v1
20 +
        env:
21 +
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 +
        with:
23 +
          tag_name: ${{ github.ref }}
24 +
          release_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@v3
51 +
52 +
      - name: Install Rust
53 +
        uses: actions-rs/toolchain@v1
54 +
        with:
55 +
          toolchain: stable
56 +
          target: ${{ matrix.target }}
57 +
          override: true
58 +
59 +
      - name: Install musl-tools (Linux musl only)
60 +
        if: matrix.target == 'x86_64-unknown-linux-musl'
61 +
        run: sudo apt-get update && sudo apt-get install -y musl-tools
62 +
63 +
      - name: Build
64 +
        uses: actions-rs/cargo@v1
65 +
        with:
66 +
          command: build
67 +
          args: --release --target ${{ matrix.target }}
68 +
69 +
      - name: Create archive (Unix)
70 +
        if: matrix.os != 'windows-latest'
71 +
        run: |
72 +
          cd target/${{ matrix.target }}/release
73 +
          tar czf ../../../${{ matrix.asset_name }}.tar.gz your-app-binary-name
74 +
75 +
      - name: Create archive (Windows)
76 +
        if: matrix.os == 'windows-latest'
77 +
        run: |
78 +
          cd target/${{ matrix.target }}/release
79 +
          7z a ../../../${{ matrix.asset_name }}.zip your-app-binary-name.exe
80 +
81 +
      - name: Upload Release Asset (Unix)
82 +
        if: matrix.os != 'windows-latest'
83 +
        uses: actions/upload-release-asset@v1
84 +
        env:
85 +
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86 +
        with:
87 +
          upload_url: ${{ needs.create-release.outputs.upload_url }}
88 +
          asset_path: ./${{ matrix.asset_name }}.tar.gz
89 +
          asset_name: ${{ matrix.asset_name }}.tar.gz
90 +
          asset_content_type: application/gzip
91 +
92 +
      - name: Upload Release Asset (Windows)
93 +
        if: matrix.os == 'windows-latest'
94 +
        uses: actions/upload-release-asset@v1
95 +
        env:
96 +
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97 +
        with:
98 +
          upload_url: ${{ needs.create-release.outputs.upload_url }}
99 +
          asset_path: ./${{ matrix.asset_name }}.zip
100 +
          asset_name: ${{ matrix.asset_name }}.zip
101 +
          asset_content_type: application/zip
102 +
103 +
  publish-crates:
104 +
    needs: build-and-upload
105 +
    runs-on: ubuntu-latest
106 +
    steps:
107 +
      - uses: actions/checkout@v3
108 +
109 +
      - name: Install Rust
110 +
        uses: actions-rs/toolchain@v1
111 +
        with:
112 +
          toolchain: stable
113 +
          override: true
114 +
115 +
      - name: Publish to crates.io
116 +
        uses: actions-rs/cargo@v1
117 +
        with:
118 +
          command: publish
119 +
          args: --token ${{ secrets.CRATES_TOKEN }}
120 +
121 +
  update-homebrew:
122 +
    needs: build-and-upload
123 +
    runs-on: ubuntu-latest
124 +
    steps:
125 +
      - uses: actions/checkout@v3
126 +
127 +
      - name: Get release info
128 +
        id: get_release
129 +
        run: |
130 +
          TAG_NAME=${GITHUB_REF#refs/tags/}
131 +
          echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
132 +
          echo "version=${TAG_NAME#v}" >> $GITHUB_OUTPUT
133 +
134 +
      - name: Update Homebrew formula
135 +
        run: |
136 +
          # Download the macOS x86_64 binary to calculate SHA256
137 +
          curl -L -o macos-binary.tar.gz \
138 +
            "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_release.outputs.tag_name }}/walletfetch-macos-x86_64.tar.gz"
139 +
140 +
          SHA256=$(shasum -a 256 macos-binary.tar.gz | cut -d' ' -f1)
141 +
142 +
          # Clone your homebrew tap repository
143 +
          git clone https://github.com/stevedylandev/homebrew-walletfetch.git
144 +
          cd homebrew-walletfetch
145 +
146 +
          # Update the formula
147 +
          cat > Formula/walletfetch.rb << EOF
148 +
          class YourApp < Formula
149 +
            desc "Like Neofetch, but for your wallet"
150 +
            homepage "https://github.com/stevedylandev/walletfetch"
151 +
            url "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_release.outputs.tag_name }}/walletfetch-macos-x86_64.tar.gz"
152 +
            sha256 "$SHA256"
153 +
            version "${{ steps.get_release.outputs.version }}"
154 +
155 +
            def install
156 +
              bin.install "walletfetch"
157 +
            end
158 +
159 +
            test do
160 +
              system "#{bin}/walletfetch", "--version"
161 +
            end
162 +
          end
163 +
          EOF
164 +
165 +
          # Commit and push changes
166 +
          git config user.name "Steve Simkins"
167 +
          git config user.email "stevedsimkins@gmail.com"
168 +
          git add Formula/walletfetch.rb
169 +
          git commit -m "Update walletfetch to ${{ steps.get_release.outputs.version }}"
170 +
          git push https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/stevedylandev/homebrew-walletfetch.git
171 +
172 +
  create-install-script:
173 +
    needs: build-and-upload
174 +
    runs-on: ubuntu-latest
175 +
    steps:
176 +
      - uses: actions/checkout@v3
177 +
178 +
      - name: Generate install script
179 +
        run: |
180 +
          mkdir -p scripts
181 +
          cat > scripts/install.sh << 'EOF'
182 +
          #!/bin/bash
183 +
          set -e
184 +
185 +
          # Detect OS and architecture
186 +
          OS=$(uname -s | tr '[:upper:]' '[:lower:]')
187 +
          ARCH=$(uname -m)
188 +
189 +
          case $OS in
190 +
              linux)
191 +
                  case $ARCH in
192 +
                      x86_64) BINARY="your-app-linux-x86_64" ;;
193 +
                      *) echo "Unsupported architecture: $ARCH"; exit 1 ;;
194 +
                  esac
195 +
                  ;;
196 +
              darwin)
197 +
                  case $ARCH in
198 +
                      x86_64) BINARY="your-app-macos-x86_64" ;;
199 +
                      arm64) BINARY="your-app-macos-aarch64" ;;
200 +
                      *) echo "Unsupported architecture: $ARCH"; exit 1 ;;
201 +
                  esac
202 +
                  ;;
203 +
              *)
204 +
                  echo "Unsupported OS: $OS"
205 +
                  exit 1
206 +
                  ;;
207 +
          esac
208 +
209 +
          # Get latest release
210 +
          LATEST_RELEASE=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
211 +
212 +
          # Download and install
213 +
          DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/${LATEST_RELEASE}/${BINARY}.tar.gz"
214 +
          INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
215 +
216 +
          echo "Downloading $BINARY from $DOWNLOAD_URL..."
217 +
          curl -L "$DOWNLOAD_URL" | tar -xz -C /tmp
218 +
219 +
          # Create install directory if it doesn't exist
220 +
          mkdir -p "$INSTALL_DIR"
221 +
222 +
          # Move binary to install directory
223 +
          mv /tmp/walletfetch "$INSTALL_DIR/"
224 +
          chmod +x "$INSTALL_DIR/walletfetch"
225 +
226 +
          echo "your-app installed to $INSTALL_DIR/walletfetch"
227 +
          echo "Make sure $INSTALL_DIR is in your PATH"
228 +
          EOF
229 +
230 +
          chmod +x scripts/install.sh
231 +
232 +
      - name: Upload install script
233 +
        uses: actions/upload-release-asset@v1
234 +
        env:
235 +
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
236 +
        with:
237 +
          upload_url: ${{ needs.create-release.outputs.upload_url }}
238 +
          asset_path: ./scripts/install.sh
239 +
          asset_name: install.sh
240 +
          asset_content_type: text/plain
.release.toml (added) +27 −0
1 +
[project]
2 +
name = "walletfetch"
3 +
binary_name = "walletfetch"
4 +
description = "Like Neofetch, but for your wallet"
5 +
homepage = "https://github.com/stevedylandev/walletfetch"
6 +
repository = "stevedylandev/walletfetch"
7 +
license = "MIT"
8 +
9 +
[homebrew]
10 +
tap_repo = "stevedylandev/homebrew-walletfetch"
11 +
formula_name = "walletfetch"
12 +
13 +
[targets]
14 +
# Linux targets
15 +
"x86_64-unknown-linux-gnu" = { asset_name = "walletfetch-linux-x86_64" }
16 +
"x86_64-unknown-linux-musl" = { asset_name = "walletfetch-linux-x86_64-musl" }
17 +
18 +
# macOS targets
19 +
"x86_64-apple-darwin" = { asset_name = "walletfetch-macos-x86_64" }
20 +
"aarch64-apple-darwin" = { asset_name = "walletfetch-macos-aarch64" }
21 +
22 +
# Windows targets
23 +
"x86_64-pc-windows-msvc" = { asset_name = "walletfetch-windows-x86_64.exe" }
24 +
25 +
[install_script]
26 +
install_dir = "$HOME/.local/bin"
27 +
script_name = "install.sh"
LICENSE (added) +21 −0
1 +
MIT License
2 +
3 +
Copyright (c) 2025 Steve Simkins
4 +
5 +
Permission is hereby granted, free of charge, to any person obtaining a copy
6 +
of this software and associated documentation files (the "Software"), to deal
7 +
in the Software without restriction, including without limitation the rights
8 +
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +
copies of the Software, and to permit persons to whom the Software is
10 +
furnished to do so, subject to the following conditions:
11 +
12 +
The above copyright notice and this permission notice shall be included in all
13 +
copies or substantial portions of the Software.
14 +
15 +
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +
SOFTWARE.