Skip to content

Cross-Platform Build #22

Cross-Platform Build

Cross-Platform Build #22

Workflow file for this run

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: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
- name: Build binary
run: |
source venv/bin/activate
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: Create and activate virtual environment
run: |
python -m venv venv
source venv\Scripts\activate
- name: Install dependencies
run: |
source venv\Scripts\activate
pip install -r requirements.txt
- name: Build binary
run: |
source venv\Scripts\activate
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: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
- name: Build ARM64 binary
run: |
source venv/bin/activate
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: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip install pyinstaller
- name: Build x86_64 binary
run: |
source venv/bin/activate
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