fix: force utf8 mode #51
This file contains 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: Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
env: | |
DIST_DIR: /tmp/builds | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
include: | |
- os: windows-latest | |
build: win-x64 | |
file_name: win_amd64 | |
- os: ubuntu-latest | |
build: linux-x64 | |
file_name: linux_amd64 | |
- os: macos-latest | |
build: osx-arm64 | |
file_name: macos_arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: "pip" | |
- run: pip install -r requirements.txt | |
- if: matrix.os != 'macos-latest' | |
name: Install UPX | |
uses: crazy-max/ghaction-upx@v3 | |
with: | |
install-only: true | |
- name: Download ffmpeg | |
run: python ffmpeg_download.py | |
shell: bash | |
- if: matrix.os == 'windows-latest' | |
name: Path for windows | |
run: | | |
rm -f "$Python_ROOT_DIR/lib/site-packages/_pyinstaller_hooks_contrib/stdhooks/hook-webrtcvad.py" | |
shell: bash | |
- name: Build executable | |
run: pyinstaller --clean -y --dist ./dist/ffsubsync_bin *.spec | |
shell: bash | |
- if: matrix.os != 'windows-latest' | |
name: Move to DIST_DIR (*nix) | |
run: | | |
mkdir -p $DIST_DIR | |
mv dist/ffsubsync_bin/ffsubsync_bin $DIST_DIR/ffsubsync_bin_${{ matrix.file_name }} | |
shell: bash | |
- if: matrix.os == 'windows-latest' | |
name: Move to DIST_DIR (win) | |
run: | | |
New-Item -ItemType Directory -Force -Path $env:DIST_DIR | |
Copy-Item -Path dist\ffsubsync_bin\ffsubsync_bin.exe -Destination $env:DIST_DIR/ffsubsync_bin_${{ matrix.file_name }} | |
shell: pwsh | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.file_name }} | |
path: ${{ env.DIST_DIR }}/* | |
if-no-files-found: error | |
retention-days: 1 | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download builds | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ env.DIST_DIR }} | |
pattern: build-* | |
merge-multiple: true | |
# checksums.txt | |
- name: Calculate checksums.txt | |
run: | | |
cd $DIST_DIR | |
sha256sum * > checksums.txt | |
# print checksums.txt | |
cat checksums.txt | |
FILES=$(find ${DIST_DIR} -type f -exec readlink -f {} \;) | |
echo -e "RELEASE_FILES<<EOF" >> $GITHUB_ENV | |
echo -e "$FILES" >> $GITHUB_ENV | |
echo -e "EOF" >> $GITHUB_ENV | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
prerelease: false | |
files: ${{ env.RELEASE_FILES }} | |
generate_release_notes: true | |
draft: true |