|
| 1 | +# Build and release Wu forensics toolkit |
| 2 | +# Triggers on version tags (v1.2.3) - builds .exe and publishes to PyPI/GitHub Releases |
| 3 | + |
| 4 | +name: Release |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-exe: |
| 16 | + name: Build Windows Executable |
| 17 | + runs-on: windows-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: '3.12' |
| 26 | + cache: 'pip' |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: | |
| 30 | + python -m pip install --upgrade pip |
| 31 | + pip install -e ".[all,dev]" |
| 32 | + pip install pyinstaller |
| 33 | +
|
| 34 | + - name: Build executable |
| 35 | + run: python build_cli.py |
| 36 | + |
| 37 | + - name: Get version from tag |
| 38 | + id: version |
| 39 | + shell: bash |
| 40 | + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 41 | + |
| 42 | + - name: Upload executable artifact |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: wu-windows-exe |
| 46 | + path: dist/wu.exe |
| 47 | + retention-days: 5 |
| 48 | + |
| 49 | + build-package: |
| 50 | + name: Build Python Package |
| 51 | + runs-on: ubuntu-latest |
| 52 | + |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - name: Set up Python |
| 57 | + uses: actions/setup-python@v5 |
| 58 | + with: |
| 59 | + python-version: '3.12' |
| 60 | + |
| 61 | + - name: Install build tools |
| 62 | + run: | |
| 63 | + python -m pip install --upgrade pip |
| 64 | + pip install build twine |
| 65 | +
|
| 66 | + - name: Build package |
| 67 | + run: python -m build |
| 68 | + |
| 69 | + - name: Upload package artifact |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: wu-python-package |
| 73 | + path: dist/*.whl |
| 74 | + retention-days: 5 |
| 75 | + |
| 76 | + release: |
| 77 | + name: Create GitHub Release |
| 78 | + needs: [build-exe, build-package] |
| 79 | + runs-on: ubuntu-latest |
| 80 | + |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v4 |
| 83 | + |
| 84 | + - name: Download Windows executable |
| 85 | + uses: actions/download-artifact@v4 |
| 86 | + with: |
| 87 | + name: wu-windows-exe |
| 88 | + path: release-assets |
| 89 | + |
| 90 | + - name: Download Python package |
| 91 | + uses: actions/download-artifact@v4 |
| 92 | + with: |
| 93 | + name: wu-python-package |
| 94 | + path: release-assets |
| 95 | + |
| 96 | + - name: Get version from tag |
| 97 | + id: version |
| 98 | + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 99 | + |
| 100 | + - name: Create Release |
| 101 | + uses: softprops/action-gh-release@v1 |
| 102 | + with: |
| 103 | + name: Wu v${{ steps.version.outputs.VERSION }} |
| 104 | + body: | |
| 105 | + ## Wu Forensics Toolkit v${{ steps.version.outputs.VERSION }} |
| 106 | +
|
| 107 | + ### Installation |
| 108 | +
|
| 109 | + **Python package:** |
| 110 | + ```bash |
| 111 | + pip install wu-forensics==${{ steps.version.outputs.VERSION }} |
| 112 | + ``` |
| 113 | +
|
| 114 | + **Standalone executable (Windows):** |
| 115 | + Download `wu.exe` below - no Python required. |
| 116 | +
|
| 117 | + ### Changes |
| 118 | + See commit history for details. |
| 119 | + files: | |
| 120 | + release-assets/wu.exe |
| 121 | + release-assets/*.whl |
| 122 | + draft: false |
| 123 | + prerelease: false |
| 124 | + |
| 125 | + publish-pypi: |
| 126 | + name: Publish to PyPI |
| 127 | + needs: [build-package] |
| 128 | + runs-on: ubuntu-latest |
| 129 | + environment: pypi |
| 130 | + |
| 131 | + steps: |
| 132 | + - name: Download package |
| 133 | + uses: actions/download-artifact@v4 |
| 134 | + with: |
| 135 | + name: wu-python-package |
| 136 | + path: dist |
| 137 | + |
| 138 | + - name: Publish to PyPI |
| 139 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 140 | + with: |
| 141 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 142 | + skip-existing: true |
0 commit comments