diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..20f98e5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build executables + +on: + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + include: + - os: ubuntu-latest + suffix: linux + ext: "" + - os: windows-latest + suffix: windows + ext: ".exe" + - os: macos-latest + suffix: macos + ext: "" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: pip install . pyinstaller + + - name: Build executable + run: pyinstaller --onefile --name waybackup --additional-hooks-dir=hooks pywaybackup/main.py + + - name: Rename artifact + shell: bash + run: mv "dist/waybackup${{ matrix.ext }}" "dist/waybackup-${{ matrix.suffix }}${{ matrix.ext }}" + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: waybackup-${{ matrix.suffix }} + path: dist/waybackup-${{ matrix.suffix }}${{ matrix.ext }} + + release: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + merge-multiple: true + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: artifacts/* + generate_release_notes: true diff --git a/hooks/hook-magic.py b/hooks/hook-magic.py new file mode 100644 index 0000000..d1cdf37 --- /dev/null +++ b/hooks/hook-magic.py @@ -0,0 +1,4 @@ +from PyInstaller.utils.hooks import collect_data_files, collect_dynamic_libs + +datas = collect_data_files("magic") +binaries = collect_dynamic_libs("magic")