|
| 1 | +# Copyright (c) 2026 Gili Tzabari. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the CAT Commercial License. |
| 4 | +# See LICENSE.md in the project root for license terms. |
| 5 | +name: Build git-filter-repo Binaries |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + version: |
| 11 | + description: 'git-filter-repo version tag (e.g., v2.38.0)' |
| 12 | + required: true |
| 13 | + default: 'v2.38.0' |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - os: ubuntu-latest |
| 21 | + platform: linux-x64 |
| 22 | + - os: ubuntu-24.04-arm |
| 23 | + platform: linux-aarch64 |
| 24 | + - os: macos-latest |
| 25 | + platform: macos-x64 |
| 26 | + - os: macos-latest |
| 27 | + platform: macos-aarch64 |
| 28 | + |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Set up Python |
| 35 | + uses: actions/setup-python@v5 |
| 36 | + with: |
| 37 | + python-version: '3.12' |
| 38 | + |
| 39 | + - name: Install PyInstaller |
| 40 | + run: pip install pyinstaller |
| 41 | + |
| 42 | + - name: Download git-filter-repo |
| 43 | + run: | |
| 44 | + set -euo pipefail |
| 45 | + VERSION="${{ github.event.inputs.version }}" |
| 46 | + curl -fsSL -o git-filter-repo \ |
| 47 | + "https://raw.githubusercontent.com/newren/git-filter-repo/${VERSION}/git-filter-repo" |
| 48 | + chmod +x git-filter-repo |
| 49 | +
|
| 50 | + - name: Build standalone binary with PyInstaller |
| 51 | + run: | |
| 52 | + set -euo pipefail |
| 53 | + pyinstaller \ |
| 54 | + --onefile \ |
| 55 | + --name git-filter-repo \ |
| 56 | + git-filter-repo |
| 57 | + ls -lh dist/git-filter-repo |
| 58 | +
|
| 59 | + - name: Verify binary runs |
| 60 | + run: | |
| 61 | + set -euo pipefail |
| 62 | + ./dist/git-filter-repo --version |
| 63 | +
|
| 64 | + - name: Generate SHA256 checksum |
| 65 | + run: | |
| 66 | + set -euo pipefail |
| 67 | + cd dist |
| 68 | + sha256sum git-filter-repo > git-filter-repo-${{ matrix.platform }}.sha256 |
| 69 | + cat git-filter-repo-${{ matrix.platform }}.sha256 |
| 70 | +
|
| 71 | + - name: Rename binary for platform |
| 72 | + run: | |
| 73 | + set -euo pipefail |
| 74 | + mv dist/git-filter-repo dist/git-filter-repo-${{ matrix.platform }} |
| 75 | +
|
| 76 | + - name: Upload artifact |
| 77 | + uses: actions/upload-artifact@v4 |
| 78 | + with: |
| 79 | + name: git-filter-repo-${{ matrix.platform }} |
| 80 | + path: | |
| 81 | + dist/git-filter-repo-${{ matrix.platform }} |
| 82 | + dist/git-filter-repo-${{ matrix.platform }}.sha256 |
| 83 | +
|
| 84 | + release: |
| 85 | + needs: build |
| 86 | + runs-on: ubuntu-latest |
| 87 | + |
| 88 | + permissions: |
| 89 | + contents: write |
| 90 | + |
| 91 | + steps: |
| 92 | + - name: Download all artifacts |
| 93 | + uses: actions/download-artifact@v4 |
| 94 | + with: |
| 95 | + path: artifacts |
| 96 | + merge-multiple: true |
| 97 | + |
| 98 | + - name: List artifacts |
| 99 | + run: ls -la artifacts/ |
| 100 | + |
| 101 | + - name: Read SHA256 checksums |
| 102 | + id: checksums |
| 103 | + run: | |
| 104 | + set -euo pipefail |
| 105 | + LINUX_X64=$(awk '{print $1}' artifacts/git-filter-repo-linux-x64.sha256) |
| 106 | + LINUX_AARCH64=$(awk '{print $1}' artifacts/git-filter-repo-linux-aarch64.sha256) |
| 107 | + MACOS_X64=$(awk '{print $1}' artifacts/git-filter-repo-macos-x64.sha256) |
| 108 | + MACOS_AARCH64=$(awk '{print $1}' artifacts/git-filter-repo-macos-aarch64.sha256) |
| 109 | + echo "linux_x64=${LINUX_X64}" >> $GITHUB_OUTPUT |
| 110 | + echo "linux_aarch64=${LINUX_AARCH64}" >> $GITHUB_OUTPUT |
| 111 | + echo "macos_x64=${MACOS_X64}" >> $GITHUB_OUTPUT |
| 112 | + echo "macos_aarch64=${MACOS_AARCH64}" >> $GITHUB_OUTPUT |
| 113 | +
|
| 114 | + - name: Create release |
| 115 | + uses: softprops/action-gh-release@v2 |
| 116 | + with: |
| 117 | + tag_name: git-filter-repo-${{ github.event.inputs.version }} |
| 118 | + name: git-filter-repo ${{ github.event.inputs.version }} Standalone Binaries |
| 119 | + body: | |
| 120 | + ## git-filter-repo ${{ github.event.inputs.version }} Standalone Binaries |
| 121 | +
|
| 122 | + Pre-built standalone binaries of [git-filter-repo](https://github.com/newren/git-filter-repo) |
| 123 | + compiled with PyInstaller. No Python installation required. |
| 124 | +
|
| 125 | + ### Platforms |
| 126 | +
|
| 127 | + | Platform | File | SHA256 | |
| 128 | + |----------|------|--------| |
| 129 | + | Linux x86_64 | `git-filter-repo-linux-x64` | `${{ steps.checksums.outputs.linux_x64 }}` | |
| 130 | + | Linux ARM64 | `git-filter-repo-linux-aarch64` | `${{ steps.checksums.outputs.linux_aarch64 }}` | |
| 131 | + | macOS Intel | `git-filter-repo-macos-x64` | `${{ steps.checksums.outputs.macos_x64 }}` | |
| 132 | + | macOS Apple Silicon | `git-filter-repo-macos-aarch64` | `${{ steps.checksums.outputs.macos_aarch64 }}` | |
| 133 | +
|
| 134 | + ### Usage |
| 135 | +
|
| 136 | + The CAT plugin automatically downloads the appropriate binary on first use. |
| 137 | + Set `GFR_FORCE_DOWNLOAD=1` to force re-download and re-verification. |
| 138 | + files: | |
| 139 | + artifacts/git-filter-repo-linux-x64 |
| 140 | + artifacts/git-filter-repo-linux-aarch64 |
| 141 | + artifacts/git-filter-repo-macos-x64 |
| 142 | + artifacts/git-filter-repo-macos-aarch64 |
| 143 | + artifacts/git-filter-repo-linux-x64.sha256 |
| 144 | + artifacts/git-filter-repo-linux-aarch64.sha256 |
| 145 | + artifacts/git-filter-repo-macos-x64.sha256 |
| 146 | + artifacts/git-filter-repo-macos-aarch64.sha256 |
| 147 | + draft: false |
| 148 | + prerelease: false |
0 commit comments