|
1 | | -name: Publish Python 🐍 distributions 📦 to PyPI |
| 1 | +name: Build executables and publish 🐍 package 📦 to PyPI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
|
7 | 7 | - "published" |
8 | 8 |
|
9 | 9 | jobs: |
| 10 | + build: |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + os: |
| 15 | + - "windows-latest" |
| 16 | + #- "macos-latest" |
| 17 | + #- "ubuntu-latest" |
| 18 | + python: |
| 19 | + - "3.10.x" |
| 20 | + cx-freeze: |
| 21 | + - "v6.14.2" |
| 22 | + name: "Build exe for ${{ matrix.os }}" |
| 23 | + runs-on: "${{ matrix.os }}" |
| 24 | + steps: |
| 25 | + |
| 26 | + # === SETUP === |
| 27 | + |
| 28 | + - name: "Setup python" |
| 29 | + uses: "actions/setup-python@v4" |
| 30 | + with: |
| 31 | + python-version: "${{ matrix.python }}" |
| 32 | + |
| 33 | + - name: "Install cx_Freeze bootloader" |
| 34 | + run: | |
| 35 | + python -m pip install cx_Freeze==${{ matrix.cx-freeze }} |
| 36 | +
|
| 37 | + # === BUILD === |
| 38 | + |
| 39 | + - name: "Clone repo" |
| 40 | + uses: "actions/checkout@v3" |
| 41 | + with: |
| 42 | + path: "./src/" |
| 43 | + |
| 44 | + - name: "Install requirements" |
| 45 | + run: | |
| 46 | + cd ./src/ |
| 47 | + python -m pip install -U -r ./requirements.txt |
| 48 | +
|
| 49 | + - name: "Build" |
| 50 | + if: "runner.os != 'macOS'" |
| 51 | + run: | |
| 52 | + cd ./src/ |
| 53 | + python ./buildGUI.py build |
| 54 | + mv ./build/*/ ./dist/ |
| 55 | +
|
| 56 | + - name: "Build macOS" |
| 57 | + if: "runner.os == 'macOS'" |
| 58 | + run: | |
| 59 | + cd ./src/ |
| 60 | + python ./buildGUI.py bdist_mac |
| 61 | + mkdir ./dist/ |
| 62 | + mv ./build/*.app/ ./dist/ |
| 63 | +
|
| 64 | + - name: "Resolve symlinks" |
| 65 | + if: "runner.os != 'Windows'" |
| 66 | + run: | |
| 67 | + cd ./src/dist/ |
| 68 | + find ./ -type l -exec echo Resolving {} \; -exec sed -i '' {} \; |
| 69 | +
|
| 70 | + # export Apple development certificate from Xcode: https://help.apple.com/xcode/mac/current/#/dev154b28f09 |
| 71 | + # base64 CERTIFICATE.p12 | pbcopy -> secrets.CODESIGN_P12_BASE64 |
| 72 | + - name: "Import macOS codesign certificate" |
| 73 | + if: "runner.os == 'macOS'" |
| 74 | + uses: "apple-actions/import-codesign-certs@v1" |
| 75 | + with: |
| 76 | + p12-file-base64: "${{ secrets.CODESIGN_P12_BASE64 }}" |
| 77 | + p12-password: "${{ secrets.CODESIGN_P12_PASSWORD }}" |
| 78 | + |
| 79 | + # security find-identity, returns something like: |
| 80 | + # A30C8432FADE0B3E7D5BA54034EF2ECA39A0BDD0 "Apple Development: [email protected] (6LR9J7UR6F)" |
| 81 | + # the first hex string is your identity -> secrets.CODESIGN_P12_NAME |
| 82 | + - name: "Codesign macOS" |
| 83 | + if: "runner.os == 'macOS'" |
| 84 | + run: | |
| 85 | + cd ./src/dist/ |
| 86 | + find ./ -type f -empty -delete |
| 87 | + codesign -s "${{ secrets.CODESIGN_P12_NAME }}" --deep -f ./*.app |
| 88 | +
|
| 89 | + # === ARTIFACT === |
| 90 | + |
| 91 | + - name: "Zip artifact" |
| 92 | + run: | |
| 93 | + 7z a -r ./${{ github.event.repository.name }}-${{ runner.os }}.zip ./src/dist/* |
| 94 | +
|
| 95 | + - name: "Upload release artifact" |
| 96 | + uses: "softprops/action-gh-release@v1" |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 99 | + with: |
| 100 | + files: "./${{ github.event.repository.name }}-${{ runner.os }}.zip" |
| 101 | + |
| 102 | + |
10 | 103 | wheel: |
11 | 104 | name: Package 📦 wheel |
12 | 105 | runs-on: ubuntu-latest |
|
0 commit comments