|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: workflow_dispatch |
| 4 | + |
| 5 | +env: |
| 6 | + pyinstaller-version: "4.0" |
| 7 | + name: modimporter |
| 8 | + |
| 9 | +jobs: |
| 10 | + archive-and-upload-python-artifacts: |
| 11 | + name: Archive and upload Python artifacts |
| 12 | + runs-on: ubuntu-latest |
| 13 | + env: |
| 14 | + artifacts-python: modimporter-python |
| 15 | + license: LICENSE |
| 16 | + readme: README.md |
| 17 | + sjson: sjson |
| 18 | + steps: |
| 19 | + - name: Checkout files |
| 20 | + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f |
| 21 | + with: |
| 22 | + ref: ${{ github.sha }} |
| 23 | + submodules: true |
| 24 | + |
| 25 | + - name: Remove `.git` folder from submodules |
| 26 | + run: | |
| 27 | + rm -r ${{ env.sjson }}/.git |
| 28 | +
|
| 29 | + - name: Upload artifacts to workflow |
| 30 | + uses: actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074 |
| 31 | + with: |
| 32 | + name: ${{ env.artifacts-python }} |
| 33 | + path: | |
| 34 | + ${{ env.name }}.py |
| 35 | + ${{ env.sjson }} |
| 36 | + ${{ env.license }} |
| 37 | + ${{ env.readme }} |
| 38 | + retention-days: 1 |
| 39 | + |
| 40 | + build-and-upload-binaries: |
| 41 | + name: Build and upload binaries |
| 42 | + runs-on: ${{ matrix.os }} |
| 43 | + strategy: |
| 44 | + matrix: |
| 45 | + os: [windows-latest, macos-latest, ubuntu-latest] |
| 46 | + include: |
| 47 | + - os: windows-latest |
| 48 | + pip-cache-path: ~\AppData\Local\pip\Cache |
| 49 | + artifacts: modimporter-windows |
| 50 | + - os: macos-latest |
| 51 | + pip-cache-path: ~/Library/Caches/pip |
| 52 | + artifacts: modimporter-macos |
| 53 | + - os: ubuntu-latest |
| 54 | + pip-cache-path: ~/.cache/pip |
| 55 | + artifacts: modimporter-linux |
| 56 | + steps: |
| 57 | + - name: Checkout files |
| 58 | + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f |
| 59 | + with: |
| 60 | + ref: ${{ github.sha }} |
| 61 | + submodules: true |
| 62 | + |
| 63 | + - name: Set up Python |
| 64 | + uses: actions/setup-python@dc73133d4da04e56a135ae2246682783cc7c7cb6 |
| 65 | + with: |
| 66 | + python-version: 3.9 |
| 67 | + |
| 68 | + - name: Retrieve pip dependencies from cache |
| 69 | + uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 |
| 70 | + with: |
| 71 | + path: | |
| 72 | + ${{ env.pythonLocation }}\lib\site-packages |
| 73 | + ${{ matrix.pip-cache-path }} |
| 74 | + key: ${{ runner.os }}-pip-cache-${{ env.pyinstaller-version }} |
| 75 | + |
| 76 | + - name: Install pip dependencies |
| 77 | + run: python -m pip install pyinstaller==${{ env.pyinstaller-version }} |
| 78 | + |
| 79 | + - name: Build binaries with PyInstaller |
| 80 | + run: python -m PyInstaller --onefile ${{ env.name }}.py --name ${{ env.name }} |
| 81 | + |
| 82 | + - name: Upload artifacts to workflow |
| 83 | + uses: actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074 |
| 84 | + with: |
| 85 | + name: ${{ matrix.artifacts }} |
| 86 | + path: dist/* |
| 87 | + retention-days: 1 |
0 commit comments