feat: default browser paths added for common OSes #14
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 Executables | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest] | |
outputs: | |
release_upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for tagging | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install pipenv | |
run: pip install pipenv | |
- name: Install dependencies | |
run: pipenv install --dev | |
- name: Install PyInstaller | |
run: pipenv run pip install pyinstaller | |
- name: Build executable for ${{ matrix.os }} | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
pipenv run pyinstaller --onefile --name weduc_timetable_extractor_windows weduc_timetable_extractor/__main__.py | |
elif [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then | |
pipenv run pyinstaller --onefile --name weduc_timetable_extractor_ubuntu_20.04 weduc_timetable_extractor/__main__.py | |
elif [[ "${{ matrix.os }}" == "ubuntu-22.04" ]]; then | |
pipenv run pyinstaller --onefile --name weduc_timetable_extractor_ubuntu_22.04 weduc_timetable_extractor/__main__.py | |
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
pipenv run pyinstaller --onefile --name weduc_timetable_extractor_macos weduc_timetable_extractor/__main__.py | |
fi | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: weduc_timetable_extractor-${{ matrix.os }} | |
path: dist/* | |
- name: Create Release | |
if: ${{ matrix.os == 'macos-latest' }} | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: v${{ github.run_number }} | |
name: Release v${{ github.run_number }} | |
body: | | |
Automated release generated by GitHub Actions. | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
upload: | |
needs: build | |
runs-on: macos-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Get Release Upload URL | |
run: echo "RELEASE_UPLOAD_URL=${{ needs.build.outputs.release_upload_url }}" >> $GITHUB_ENV | |
- name: Upload Release Assets | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -euo pipefail | |
# Strip the template placeholder from the upload URL | |
UPLOAD_URL="${RELEASE_UPLOAD_URL%\{*}" | |
for filepath in artifacts/**/*; do | |
if [ -f "$filepath" ]; then | |
filename=$(basename "$filepath") | |
echo "Uploading $filename..." | |
curl \ | |
-X POST \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Content-Type: application/octet-stream" \ | |
--data-binary @"$filepath" \ | |
"${UPLOAD_URL}?name=$filename" | |
fi | |
done |