Cross-Platform Build #18
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: Cross-Platform Build | |
on: | |
# push: | |
# branches: | |
# - main | |
# pull_request: | |
# branches: | |
# - main | |
workflow_dispatch: | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
short_sha: ${{ steps.short_sha.outputs.short_sha }} | |
steps: | |
- name: Set sha | |
id: short_sha | |
run: echo "short_sha=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT | |
build-linux: | |
runs-on: ubuntu-latest | |
needs: prepare | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Build binary | |
run: pyinstaller lang_detect.spec | |
- name: Copy config files | |
run: cp config.json dist/lang_detect/ | |
- name: Zip the dist folder | |
run: cd dist/ && zip -r ../lang-detect_${{ needs.prepare.outputs.short_sha }}_linux-x86_64.zip lang_detect/ && cd ../ | |
- name: Upload ZIP to FTP | |
run: | | |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_linux-x86_64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs | |
build-windows: | |
runs-on: windows-latest | |
needs: prepare | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build binary | |
run: pyinstaller lang_detect.spec | |
- name: Copy config files | |
run: cp config.json dist/lang_detect/ | |
- name: Zip the dist folder | |
run: Compress-Archive -Path dist/* -DestinationPath lang-detect_${{ needs.prepare.outputs.short_sha }}_windows-x86_64.zip | |
- name: Upload ZIP to FTP | |
run: | | |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_windows-x86_64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs | |
build-macos-arm64: | |
runs-on: macos-14 | |
needs: prepare | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build ARM64 binary | |
run: pyinstaller lang_detect.spec | |
- name: Copy config files | |
run: cp config.json dist/lang_detect/ | |
- name: Zip the dist folder | |
run: cd dist/ && zip -r ../lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-arm64.zip lang_detect/ && cd ../ | |
- name: Upload ZIP to FTP | |
shell: bash | |
run: | | |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-arm64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs | |
build-macos-x86_64: | |
runs-on: macos-latest | |
needs: prepare | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: pip install pyinstaller | |
- name: Build x86_64 binary | |
run: pyinstaller lang_detect.spec | |
- name: Copy config files | |
run: cp config.json dist/lang_detect/ | |
- name: Zip the dist folder | |
run: cd dist/ && zip -r ../lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-x86_64.zip lang_detect/ && cd ../ | |
- name: Upload ZIP to FTP | |
run: | | |
curl -T lang-detect_${{ needs.prepare.outputs.short_sha }}_macos-x86_64.zip ftp://dev.linux.build.pdfix.net/public/builds/plug-ins/lang-detect/main/${{ needs.prepare.outputs.short_sha }}/ --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs |