AutoSubSync #87
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AutoSubSync | |
| on: | |
| workflow_dispatch: | |
| env: | |
| DIST_DIR: /tmp/builds | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, macos-latest, macos-13] | |
| include: | |
| - os: windows-latest | |
| build: win-x64 | |
| file_name: win_amd64 | |
| - os: macos-latest | |
| build: osx-arm64 | |
| file_name: macos_arm64 | |
| - os: macos-13 | |
| build: macos-amd64 | |
| file_name: macos_amd64 | |
| runs-on: ${{ matrix.os }} | |
| outputs: | |
| version: ${{ steps.set-version.outputs.version }} | |
| ffmpeg_version: ${{ steps.set-version.outputs.ffmpeg_version }} | |
| sync_tools_info: ${{ steps.set-version.outputs.sync_tools_info }} | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12.8 | |
| cache: "pip" | |
| - name: Install required modules globally | |
| run: | | |
| pip install requests | |
| - name: Run build script | |
| run: | | |
| python build.py | |
| - name: Parse versions.json (Windows) | |
| if: matrix.os == 'windows-latest' | |
| id: set-version | |
| run: | | |
| if (Test-Path main/resources/versions.json) { | |
| $json = Get-Content -Raw -Path main/resources/versions.json | ConvertFrom-Json | |
| $version = $json.AutoSubSync | |
| $ffmpeg_version = $json.ffmpeg | |
| # Build sync tools info string | |
| $sync_tools_info = "" | |
| foreach ($tool in $json.sync_tools.PSObject.Properties.Name) { | |
| $tool_version = $json.sync_tools.$tool.version | |
| $tool_github = $json.sync_tools.$tool.github | |
| $sync_tools_info += ">[${tool}](${tool_github}): ${tool_version}`n" | |
| } | |
| echo "version=$version" >> $env:GITHUB_OUTPUT | |
| echo "ffmpeg_version=$ffmpeg_version" >> $env:GITHUB_OUTPUT | |
| echo "sync_tools_info<<EOF" >> $env:GITHUB_OUTPUT | |
| echo $sync_tools_info >> $env:GITHUB_OUTPUT | |
| echo "EOF" >> $env:GITHUB_OUTPUT | |
| } else { | |
| Write-Host "versions.json not found" | |
| } | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts-${{ matrix.file_name }} | |
| path: | | |
| *.zip | |
| *.tar.gz | |
| build-linux-ubuntu: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| - name: Build using build.py with Python 3.12 in Docker | |
| run: | | |
| docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace \ | |
| --env DEBIAN_FRONTEND=noninteractive \ | |
| --env TZ=Etc/UTC \ | |
| --entrypoint bash \ | |
| python:3.12.8-slim \ | |
| -c "apt-get update && \ | |
| apt-get install -y tzdata tk-dev libglib2.0-0 libxkbcommon-x11-0 libxcb-xinerama0 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-xfixes0 libxcb-xkb1 libxrender1 libsm6 libxext6 libx11-xcb1 libdbus-1-3 libxcb-sync1 libxcb-glx0 libgdk-pixbuf2.0-0 libgtk-3-0 libpango-1.0-0 libcairo2 libatk1.0-0 libpangocairo-1.0-0 libcairo-gobject2 && \ | |
| echo 'GLIBC Version:' && \ | |
| ldd --version | head -n 1 && \ | |
| pip install --upgrade pip setuptools wheel requests pyinstaller && \ | |
| python build.py" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts-linux_amd64 | |
| path: | | |
| *.zip | |
| *.tar.gz | |
| release: | |
| needs: [build, build-linux-ubuntu] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| - name: Download builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ env.DIST_DIR }} | |
| pattern: build-* | |
| merge-multiple: true | |
| - name: Read CHANGELOG | |
| id: read-changelog | |
| run: | | |
| changelog=$(cat CHANGELOG) | |
| echo "changelog<<EOF" >> $GITHUB_ENV | |
| echo "$changelog" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ needs.build.outputs.version }}" | |
| name: "AutoSubSync v${{ needs.build.outputs.version }}" | |
| body: | | |
| ${{ env.changelog }} | |
| > MacOS users please read [this](https://github.com/denizsafak/AutoSubSync?tab=readme-ov-file#for-macososx-users). | |
| >Included: | |
| >[ffmpeg](https://github.com/FFmpeg/FFmpeg): ${{ needs.build.outputs.ffmpeg_version }} | |
| ${{ needs.build.outputs.sync_tools_info }} | |
| files: ${{ env.DIST_DIR }}/* | |
| generate_release_notes: false | |
| draft: true | |
| overwrite: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN }} |