|
| 1 | +name: Build and Release SimpleCutPy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*.*.*" |
| 7 | + branches: |
| 8 | + - main |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: windows-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Set up Python |
| 21 | + uses: actions/setup-python@v4 |
| 22 | + with: |
| 23 | + python-version: "3.12" |
| 24 | + |
| 25 | + - name: Install FFmpeg |
| 26 | + uses: FedericoCarboni/setup-ffmpeg@v2 |
| 27 | + with: |
| 28 | + ffmpeg-version: "6.0" |
| 29 | + architecture: "x64" |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: | |
| 33 | + python -m pip install --upgrade pip |
| 34 | + pip install -e . |
| 35 | + pip install pyinstaller |
| 36 | +
|
| 37 | + - name: Build with PyInstaller |
| 38 | + run: | |
| 39 | + pyinstaller SimpleCutPy.spec |
| 40 | +
|
| 41 | + - name: Upload build artifacts |
| 42 | + uses: actions/upload-artifact@v3 |
| 43 | + with: |
| 44 | + name: SimpleCutPy-build |
| 45 | + path: dist/SimpleCutPy/ |
| 46 | + |
| 47 | + release: |
| 48 | + needs: build |
| 49 | + runs-on: windows-latest |
| 50 | + if: startsWith(github.ref, 'refs/tags/') |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v3 |
| 54 | + |
| 55 | + - name: Download build artifacts |
| 56 | + uses: actions/download-artifact@v3 |
| 57 | + with: |
| 58 | + name: SimpleCutPy-build |
| 59 | + path: dist/SimpleCutPy/ |
| 60 | + |
| 61 | + - name: Create zip archive |
| 62 | + run: | |
| 63 | + cd dist |
| 64 | + 7z a -tzip SimpleCutPy-${{ github.ref_name }}.zip SimpleCutPy/ |
| 65 | +
|
| 66 | + - name: Create Release |
| 67 | + id: create_release |
| 68 | + uses: actions/create-release@v1 |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + with: |
| 72 | + tag_name: ${{ github.ref_name }} |
| 73 | + release_name: Release ${{ github.ref_name }} |
| 74 | + draft: false |
| 75 | + prerelease: false |
| 76 | + |
| 77 | + - name: Upload Release Asset |
| 78 | + uses: actions/upload-release-asset@v1 |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + with: |
| 82 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 83 | + asset_path: dist/SimpleCutPy-${{ github.ref_name }}.zip |
| 84 | + asset_name: SimpleCutPy-${{ github.ref_name }}.zip |
| 85 | + asset_content_type: application/zip |
0 commit comments