|
| 1 | +name: Cross-Platform Package Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + linux-build: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + |
| 14 | + - name: Set up Python |
| 15 | + uses: actions/setup-python@v2 |
| 16 | + with: |
| 17 | + python-version: '3.10' |
| 18 | + |
| 19 | + - name: Install dependencies |
| 20 | + run: pip install -r requirements.txt |
| 21 | + |
| 22 | + - name: Install cx_Freeze |
| 23 | + run: pip install cx_Freeze |
| 24 | + |
| 25 | + - name: Freeze Python Script |
| 26 | + run: cxfreeze -c app.py --target-dir trackenn --target-name trackenn |
| 27 | + |
| 28 | + - name: Copy directories and files |
| 29 | + run: | |
| 30 | + cp -r front trackenn/ |
| 31 | + cp -r data trackenn/ |
| 32 | + cp config.yaml trackenn/ |
| 33 | +
|
| 34 | + - name: Zip Distribution Directory |
| 35 | + run: zip -r trackenn-linux.zip trackenn/ |
| 36 | + |
| 37 | + - name: Upload Linux Asset |
| 38 | + uses: actions/upload-artifact@v2 |
| 39 | + with: |
| 40 | + name: trackenn-linux.zip |
| 41 | + path: trackenn-linux.zip |
| 42 | + |
| 43 | + windows-build: |
| 44 | + runs-on: windows-latest |
| 45 | + needs: linux-build |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v2 |
| 48 | + |
| 49 | + - name: Set up Python |
| 50 | + uses: actions/setup-python@v2 |
| 51 | + with: |
| 52 | + python-version: '3.10' |
| 53 | + |
| 54 | + - name: Install dependencies |
| 55 | + run: pip install -r requirements.txt |
| 56 | + |
| 57 | + - name: Install cx_Freeze |
| 58 | + run: pip install cx_Freeze |
| 59 | + |
| 60 | + - name: Freeze Python Script |
| 61 | + run: cxfreeze -c app.py --target-dir trackenn --target-name trackenn |
| 62 | + |
| 63 | + - name: Copy directories and files |
| 64 | + run: | |
| 65 | + Copy-Item -Path front -Destination trackenn/ -Recurse |
| 66 | + Copy-Item -Path data -Destination trackenn/ -Recurse |
| 67 | + Copy-Item -Path config.yaml -Destination trackenn/ |
| 68 | +
|
| 69 | + - name: Zip Distribution Directory |
| 70 | + run: Compress-Archive -Path trackenn/* -DestinationPath trackenn-windows.zip |
| 71 | + |
| 72 | + - name: Upload Windows Asset |
| 73 | + uses: actions/upload-artifact@v2 |
| 74 | + with: |
| 75 | + name: trackenn-windows.zip |
| 76 | + path: trackenn-windows.zip |
| 77 | + |
| 78 | + create-release: |
| 79 | + needs: [linux-build, windows-build] |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v2 |
| 83 | + |
| 84 | + - name: Download Artifacts |
| 85 | + uses: actions/download-artifact@v2 |
| 86 | + |
| 87 | + - name: Create Release |
| 88 | + id: create_release |
| 89 | + uses: actions/create-release@v1 |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + with: |
| 93 | + tag_name: ${{ github.ref }} |
| 94 | + release_name: Release ${{ github.ref }} |
| 95 | + draft: false |
| 96 | + prerelease: false |
| 97 | + |
| 98 | + - name: Upload Release Asset (Linux) |
| 99 | + uses: actions/upload-release-asset@v1 |
| 100 | + env: |
| 101 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 102 | + with: |
| 103 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 104 | + asset_path: ./trackenn-linux.zip |
| 105 | + asset_name: trackenn-linux.zip |
| 106 | + asset_content_type: application/zip |
| 107 | + |
| 108 | + - name: Upload Release Asset (Windows) |
| 109 | + uses: actions/upload-release-asset@v1 |
| 110 | + env: |
| 111 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 112 | + with: |
| 113 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 114 | + asset_path: ./trackenn-windows.zip |
| 115 | + asset_name: trackenn-windows.zip |
| 116 | + asset_content_type: application/zip |
| 117 | + |
0 commit comments