|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' # Run workflow when a version tag is pushed (e.g., v1.0.0) |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-and-release: |
| 10 | + name: Build and Release for ${{ matrix.os }} |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - os: ubuntu-latest |
| 16 | + platform: linux |
| 17 | + target: x86_64-unknown-linux-gnu |
| 18 | + asset_name: fatt-linux-amd64 |
| 19 | + artifact_name: fatt-linux-amd64 |
| 20 | + strip: true |
| 21 | + - os: macos-latest |
| 22 | + platform: macos |
| 23 | + target: x86_64-apple-darwin |
| 24 | + asset_name: fatt-macos-amd64 |
| 25 | + artifact_name: fatt-macos-amd64 |
| 26 | + strip: true |
| 27 | + - os: macos-latest |
| 28 | + platform: macos |
| 29 | + target: aarch64-apple-darwin |
| 30 | + asset_name: fatt-macos-arm64 |
| 31 | + artifact_name: fatt-macos-arm64 |
| 32 | + strip: true |
| 33 | + - os: windows-latest |
| 34 | + platform: windows |
| 35 | + target: x86_64-pc-windows-msvc |
| 36 | + asset_name: fatt-windows-amd64.exe |
| 37 | + artifact_name: fatt-windows-amd64 |
| 38 | + strip: false |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout code |
| 42 | + uses: actions/checkout@v3 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + |
| 46 | + - name: Set up Rust |
| 47 | + uses: actions-rs/toolchain@v1 |
| 48 | + with: |
| 49 | + toolchain: stable |
| 50 | + profile: minimal |
| 51 | + target: ${{ matrix.target }} |
| 52 | + override: true |
| 53 | + |
| 54 | + - name: Build |
| 55 | + uses: actions-rs/cargo@v1 |
| 56 | + with: |
| 57 | + command: build |
| 58 | + args: --release --target ${{ matrix.target }} |
| 59 | + |
| 60 | + - name: Strip binary (Unix) |
| 61 | + if: matrix.strip |
| 62 | + run: | |
| 63 | + if [ "${{ matrix.platform }}" = "linux" ]; then |
| 64 | + strip target/${{ matrix.target }}/release/fatt |
| 65 | + elif [ "${{ matrix.platform }}" = "macos" ]; then |
| 66 | + strip target/${{ matrix.target }}/release/fatt |
| 67 | + fi |
| 68 | +
|
| 69 | + - name: Prepare artifact (Windows) |
| 70 | + if: matrix.platform == 'windows' |
| 71 | + run: | |
| 72 | + mkdir ${{ matrix.artifact_name }} |
| 73 | + cp target/${{ matrix.target }}/release/fatt.exe ${{ matrix.artifact_name }}/ |
| 74 | + cp LICENSE ${{ matrix.artifact_name }}/ |
| 75 | + cp -r rule-examples ${{ matrix.artifact_name }}/ |
| 76 | + 7z a -tzip ${{ matrix.artifact_name }}.zip ${{ matrix.artifact_name }} |
| 77 | + shell: bash |
| 78 | + |
| 79 | + - name: Prepare artifact (Unix) |
| 80 | + if: matrix.platform != 'windows' |
| 81 | + run: | |
| 82 | + mkdir ${{ matrix.artifact_name }} |
| 83 | + cp target/${{ matrix.target }}/release/fatt ${{ matrix.artifact_name }}/ |
| 84 | + cp LICENSE ${{ matrix.artifact_name }}/ |
| 85 | + cp -r rule-examples ${{ matrix.artifact_name }}/ |
| 86 | + tar -czf ${{ matrix.artifact_name }}.tar.gz ${{ matrix.artifact_name }} |
| 87 | +
|
| 88 | + - name: Upload artifact |
| 89 | + uses: actions/upload-artifact@v3 |
| 90 | + with: |
| 91 | + name: ${{ matrix.artifact_name }} |
| 92 | + path: | |
| 93 | + ${{ matrix.artifact_name }}.zip |
| 94 | + ${{ matrix.artifact_name }}.tar.gz |
| 95 | + if-no-files-found: ignore |
| 96 | + |
| 97 | + create-release: |
| 98 | + name: Create GitHub Release |
| 99 | + needs: build-and-release |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Checkout code |
| 103 | + uses: actions/checkout@v3 |
| 104 | + |
| 105 | + - name: Download all artifacts |
| 106 | + uses: actions/download-artifact@v3 |
| 107 | + with: |
| 108 | + path: artifacts |
| 109 | + |
| 110 | + - name: Display structure of downloaded files |
| 111 | + run: ls -R artifacts |
| 112 | + |
| 113 | + - name: Extract tag name |
| 114 | + id: extract_tag |
| 115 | + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
| 116 | + |
| 117 | + - name: Create Release |
| 118 | + id: create_release |
| 119 | + uses: softprops/action-gh-release@v1 |
| 120 | + env: |
| 121 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + with: |
| 123 | + name: FATT ${{ steps.extract_tag.outputs.VERSION }} |
| 124 | + draft: false |
| 125 | + prerelease: false |
| 126 | + files: | |
| 127 | + artifacts/*/*.zip |
| 128 | + artifacts/*/*.tar.gz |
| 129 | + body: | |
| 130 | + # FATT (Find All The Things) ${{ steps.extract_tag.outputs.VERSION }} |
| 131 | + |
| 132 | + A high-performance, modular, asynchronous, and distributed security scanning CLI tool. |
| 133 | + |
| 134 | + ## Downloads |
| 135 | + |
| 136 | + - **Windows**: fatt-windows-amd64.exe |
| 137 | + - **macOS Intel**: fatt-macos-amd64 |
| 138 | + - **macOS Apple Silicon**: fatt-macos-arm64 |
| 139 | + - **Linux**: fatt-linux-amd64 |
| 140 | + |
| 141 | + ## Installation |
| 142 | + |
| 143 | + Extract the archive and run the executable from your terminal or command prompt. |
| 144 | + |
| 145 | + ``` |
| 146 | + # Linux/macOS |
| 147 | + chmod +x fatt |
| 148 | + ./fatt scan -i domains.txt |
| 149 | + |
| 150 | + # Windows |
| 151 | + fatt.exe scan -i domains.txt |
| 152 | + ``` |
| 153 | + |
| 154 | + ## Changelog |
| 155 | + |
| 156 | + <!-- Add your release notes here --> |
0 commit comments