diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0eac650..a454070 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,43 +1,83 @@ -name: Build with PyInstaller +name: Build on: - push: - branches: - - master - pull_request: - branches: - - master + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 jobs: - build: - name: Build on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [windows-latest, macos-latest, ubuntu-latest] - python-version: [3.11] - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Build with PyInstaller - run: | - pyinstaller --onefile --name counter_phisher --i assets/images/fish.ico counter_phisher.py - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: counter_phisher-${{ matrix.os }}-py${{ matrix.python-version }} - path: dist/ + + createrelease: + name: Create Release + runs-on: [ ubuntu-latest ] + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Output Release URL File + run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt + - name: Save Release URL File for publish + uses: actions/upload-artifact@v1 + with: + name: release_url + path: release_url.txt + + build: + name: Build packages + needs: createrelease + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-latest + TARGET: macos + CMD_BUILD: > + pyinstaller -F -w -n counterphisher -i assets/images/fish.icns cli.py && + cd dist/ && + zip -r9 counterphisher counterphisher.app/ + OUT_FILE_NAME: counterphisher.zip + ASSET_MIME: application/zip + - os: windows-latest + TARGET: windows + CMD_BUILD: pyinstaller -F -w -n counterphisher -i assets/images/fish.ico cli.py + OUT_FILE_NAME: counterphisher.exe + ASSET_MIME: application/vnd.microsoft.portable-executable + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.11 + uses: actions/setup-python@v2 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Build with pyinstaller for ${{matrix.TARGET}} + run: ${{matrix.CMD_BUILD}} + - name: Load Release URL File from release job + uses: actions/download-artifact@v1 + with: + name: release_url + - name: Get Release File Name & Upload URL + id: get_release_info + shell: bash + run: | + value=`cat release_url/release_url.txt` + echo ::set-output name=upload_url::$value + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./dist/${{ matrix.OUT_FILE_NAME}} + asset_name: ${{ matrix.OUT_FILE_NAME}} + asset_content_type: ${{ matrix.ASSET_MIME}} \ No newline at end of file diff --git a/assets/images/fish.icns b/assets/images/fish.icns new file mode 100644 index 0000000..274457a Binary files /dev/null and b/assets/images/fish.icns differ