From 14997f04cd62507901a56deb2504694533d8599c Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Thu, 26 Jun 2025 21:15:02 -0500 Subject: optimize pyinstaller and auto release on tag + add binaries as release assets and fix the pyinstaller action --- .github/workflows/pyinstaller-release.yaml | 49 ++++++++++++++++++++++-------- .github/workflows/release-on-tag.yaml | 23 ++++++++++++++ 2 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/release-on-tag.yaml (limited to '.github') diff --git a/.github/workflows/pyinstaller-release.yaml b/.github/workflows/pyinstaller-release.yaml index 44e2716..a4255b7 100644 --- a/.github/workflows/pyinstaller-release.yaml +++ b/.github/workflows/pyinstaller-release.yaml @@ -5,11 +5,8 @@ on: types: [created] jobs: - build: + webpack: runs-on: ubuntu-latest - strategy: - matrix: - arch: [x64, arm64] steps: - name: Checkout uses: actions/checkout@v4 @@ -27,11 +24,14 @@ jobs: working-directory: ./static run: npx webpack - - name: Set up QEMU for cross-architecture - if: matrix.arch == 'arm64' - uses: docker/setup-qemu-action@v3 - with: - platforms: arm64 + pyinstaller: + runs-on: ubuntu-latest + strategy: + matrix: + arch: [x64, arm64] + steps: + - name: Checkout + uses: actions/checkout@v4 # - name: Run pyinstaller # uses: sayyid5416/pyinstaller@v1 @@ -42,6 +42,12 @@ jobs: # #upload_exe_with_name: 'pix' # options: --onefile + - name: Set up QEMU for cross-architecture + if: matrix.arch == 'arm64' + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - name: Set up Python uses: actions/setup-python@v5 with: @@ -64,13 +70,32 @@ jobs: TARGET_ARCH: ${{ matrix.arch }} run: | if [ "${{ matrix.arch }}" = "arm64" ]; then - pyinstaller --onefile --target-arch aarch64 pix.py + pyinstaller --onefile --target-arch aarch64 pix.spec else - pyinstaller --onefile pix.py + pyinstaller --onefile pix.spec fi + - name: Rename the executable + run: | + mv ./dist/pix ./dist/pixpy-${{ matrix.arch }} + - name: Upload executable uses: actions/upload-artifact@v4 with: name: pixpy-${{ matrix.arch }} - path: dist/pix + path: ./dist/pixpy-${{ matrix.arch }} + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create Release and Upload Assets + uses: softprops/action-gh-release@v2 + with: + files: | + ./dist/pixpy-* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-on-tag.yaml b/.github/workflows/release-on-tag.yaml new file mode 100644 index 0000000..ef4c91c --- /dev/null +++ b/.github/workflows/release-on-tag.yaml @@ -0,0 +1,23 @@ +name: Create Release + +on: + push: + tags: + - 'v*' # This will trigger the action when you push a tag like v1.0, v1.1, etc. + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Create Release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions -- cgit v1.2.3