|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [edited, published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: PyInstaller for ${{ matrix.os }} |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - os: ubuntu-16.04 |
| 15 | + # use old linux so that the shared library versioning is more portable |
| 16 | + artifact_name: floss |
| 17 | + asset_name: linux |
| 18 | + - os: windows-latest |
| 19 | + artifact_name: floss.exe |
| 20 | + asset_name: windows |
| 21 | + - os: macos-latest |
| 22 | + artifact_name: floss |
| 23 | + asset_name: macos |
| 24 | + steps: |
| 25 | + - name: Checkout floss |
| 26 | + uses: actions/checkout@v2 |
| 27 | + with: |
| 28 | + submodules: true |
| 29 | + - name: Set up Python 2.7 |
| 30 | + uses: actions/setup-python@v2 |
| 31 | + with: |
| 32 | + python-version: 2.7 |
| 33 | + - if: matrix.os == 'windows-latest' |
| 34 | + run: | |
| 35 | + choco install vcredist2008 |
| 36 | + choco install --ignore-dependencies vcpython27 |
| 37 | + - name: Install PyInstaller |
| 38 | + # pyinstaller 4 doesn't support Python 2.7 |
| 39 | + run: pip install 'pyinstaller==3.*' |
| 40 | + - name: Install floss |
| 41 | + run: pip install -e . |
| 42 | + - name: Build standalone executable |
| 43 | + run: pyinstaller .github/pyinstaller/floss.spec |
| 44 | + - name: Does it run? |
| 45 | + run: dist/floss --help |
| 46 | + - uses: actions/upload-artifact@v2 |
| 47 | + with: |
| 48 | + name: ${{ matrix.asset_name }} |
| 49 | + path: dist/${{ matrix.artifact_name }} |
| 50 | + |
| 51 | + zip: |
| 52 | + name: zip ${{ matrix.asset_name }} |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: build |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + include: |
| 58 | + - asset_name: linux |
| 59 | + artifact_name: floss |
| 60 | + - asset_name: windows |
| 61 | + artifact_name: floss.exe |
| 62 | + - asset_name: macos |
| 63 | + artifact_name: floss |
| 64 | + steps: |
| 65 | + - name: Download ${{ matrix.asset_name }} |
| 66 | + uses: actions/download-artifact@v2 |
| 67 | + with: |
| 68 | + name: ${{ matrix.asset_name }} |
| 69 | + - name: Set executable flag |
| 70 | + run: chmod +x ${{ matrix.artifact_name }} |
| 71 | + - name: Set zip name |
| 72 | + run: echo "zip_name=floss-${GITHUB_REF#refs/tags/}-${{ matrix.asset_name }}.zip" >> $GITHUB_ENV |
| 73 | + - name: Zip ${{ matrix.artifact_name }} into ${{ env.zip_name }} |
| 74 | + run: zip ${{ env.zip_name }} ${{ matrix.artifact_name }} |
| 75 | + - name: Upload ${{ env.zip_name }} to GH Release |
| 76 | + uses: svenstaro/upload-release-action@v2 |
| 77 | + with: |
| 78 | + repo_token: ${{ secrets.GITHUB_TOKEN}} |
| 79 | + file: ${{ env.zip_name }} |
| 80 | + tag: ${{ github.ref }} |
0 commit comments