diff --git a/build-python-executable.yaml b/build-python-executable.yaml new file mode 100644 index 0000000..34c3499 --- /dev/null +++ b/build-python-executable.yaml @@ -0,0 +1,57 @@ +name: Build and Release Python Scripts +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + strategy: + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - run: | + pip install -r requirements.txt + pip install pyinstaller + + - name: Build executables + run: | + for file in *.py + do + pyinstaller --onefile "$file" + done + shell: bash + + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.os }}-executables + path: dist/* + + release: + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/download-artifact@v3 + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + **/* + tag_name: v${{ github.run_number }} + draft: false + prerelease: false + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build-python-executable.yml b/build-python-executable.yml deleted file mode 100644 index b0ca0a1..0000000 --- a/build-python-executable.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Build Python Executable - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build-windows: - name: Build on Windows - runs-on: windows-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install dependencies - run: pip install -r requirements.txt - - - name: Install PyInstaller - run: pip install pyinstaller - - - name: Compile Python script to executable - run: pyinstaller --onefile your_script.py - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: windows-executable - path: dist/your_script.exe - - build-macos: - name: Build on macOS - runs-on: macos-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install dependencies - run: pip install -r requirements.txt - - - name: Install PyInstaller - run: pip install pyinstaller - - - name: Compile Python script to executable - run: pyinstaller --onefile your_script.py - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: macos-executable - path: dist/your_script - - build-linux: - name: Build on Linux - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install dependencies - run: pip install -r requirements.txt - - - name: Install PyInstaller - run: pip install pyinstaller - - - name: Compile Python script to executable - run: pyinstaller --onefile your_script.py - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: linux-executable - path: dist/your_script